Lines Matching defs:avc_context

58                               AVCodecContext* avc_context,
62 int newsize = avc_context->extradata_size + 2 + packet->bytes;
69 } else if (newsize < avc_context->extradata_size) {
72 if ((err = av_reallocp(&avc_context->extradata, newsize)) < 0) {
73 avc_context->extradata_size = 0;
78 av_log(avc_context, AV_LOG_ERROR, "concatenate_packet failed: %s\n", message);
82 avc_context->extradata_size = newsize;
83 AV_WB16(avc_context->extradata + (*offset), packet->bytes);
85 memcpy(avc_context->extradata + (*offset), packet->packet, packet->bytes);
165 static av_cold int encode_init(AVCodecContext* avc_context)
171 TheoraContext *h = avc_context->priv_data;
172 uint32_t gop_size = avc_context->gop_size;
177 t_info.frame_width = FFALIGN(avc_context->width, 16);
178 t_info.frame_height = FFALIGN(avc_context->height, 16);
179 t_info.pic_width = avc_context->width;
180 t_info.pic_height = avc_context->height;
185 t_info.fps_numerator = avc_context->time_base.den;
186 t_info.fps_denominator = avc_context->time_base.num;
187 if (avc_context->sample_aspect_ratio.num) {
188 t_info.aspect_numerator = avc_context->sample_aspect_ratio.num;
189 t_info.aspect_denominator = avc_context->sample_aspect_ratio.den;
195 if (avc_context->color_primaries == AVCOL_PRI_BT470M)
197 else if (avc_context->color_primaries == AVCOL_PRI_BT470BG)
202 if (avc_context->pix_fmt == AV_PIX_FMT_YUV420P)
204 else if (avc_context->pix_fmt == AV_PIX_FMT_YUV422P)
206 else if (avc_context->pix_fmt == AV_PIX_FMT_YUV444P)
209 av_log(avc_context, AV_LOG_ERROR, "Unsupported pix_fmt\n");
212 ret = av_pix_fmt_get_chroma_sub_sample(avc_context->pix_fmt, &h->uv_hshift, &h->uv_vshift);
216 if (avc_context->flags & AV_CODEC_FLAG_QSCALE) {
222 t_info.quality = av_clipf(avc_context->global_quality / (float)FF_QP2LAMBDA, 0, 10) * 6.3;
225 t_info.target_bitrate = avc_context->bit_rate;
232 av_log(avc_context, AV_LOG_ERROR, "theora_encode_init failed\n");
242 av_log(avc_context, AV_LOG_ERROR, "Error setting GOP size\n");
247 if (avc_context->flags & AV_CODEC_FLAG_PASS1) {
248 if ((ret = get_stats(avc_context, 0)) < 0)
250 } else if (avc_context->flags & AV_CODEC_FLAG_PASS2) {
251 if ((ret = submit_stats(avc_context)) < 0)
268 if ((ret = concatenate_packet(&offset, avc_context, &o_packet)) < 0)
276 static int encode_frame(AVCodecContext* avc_context, AVPacket *pkt,
280 TheoraContext *h = avc_context->priv_data;
287 if (avc_context->flags & AV_CODEC_FLAG_PASS1)
288 if ((ret = get_stats(avc_context, 1)) < 0)
295 t_yuv_buffer[i].width = FFALIGN(avc_context->width, 16) >> (i && h->uv_hshift);
296 t_yuv_buffer[i].height = FFALIGN(avc_context->height, 16) >> (i && h->uv_vshift);
301 if (avc_context->flags & AV_CODEC_FLAG_PASS2)
302 if ((ret = submit_stats(avc_context)) < 0)
320 av_log(avc_context, AV_LOG_ERROR, "theora_encode_YUVin failed (%s) [%d]\n", message, result);
324 if (avc_context->flags & AV_CODEC_FLAG_PASS1)
325 if ((ret = get_stats(avc_context, 0)) < 0)
338 av_log(avc_context, AV_LOG_ERROR, "theora_encode_packetout failed [%d]\n", result);
343 if ((ret = ff_get_encode_buffer(avc_context, pkt, o_packet.bytes, 0)) < 0)
357 static av_cold int encode_close(AVCodecContext* avc_context)
359 TheoraContext *h = avc_context->priv_data;
363 av_freep(&avc_context->stats_out);
364 avc_context->extradata_size = 0;