Lines Matching refs:avctx
42 /* We clip the value of avctx->trellis to prevent data type overflows and
47 static av_cold int g722_encode_close(AVCodecContext *avctx)
49 G722Context *c = avctx->priv_data;
59 static av_cold int g722_encode_init(AVCodecContext * avctx)
61 G722Context *c = avctx->priv_data;
64 if (avctx->channels != 1) {
65 av_log(avctx, AV_LOG_ERROR, "Only mono tracks are allowed.\n");
73 if (avctx->trellis) {
74 int frontier = 1 << avctx->trellis;
88 if (avctx->frame_size) {
90 if (avctx->frame_size & 1 || avctx->frame_size > MAX_FRAME_SIZE) {
93 if (avctx->frame_size == 1)
95 else if (avctx->frame_size > MAX_FRAME_SIZE)
98 new_frame_size = avctx->frame_size - 1;
100 av_log(avctx, AV_LOG_WARNING, "Requested frame size is not "
102 avctx->frame_size);
103 avctx->frame_size = new_frame_size;
108 avctx->frame_size = 320;
110 avctx->delay = 22;
112 if (avctx->trellis) {
114 if (avctx->trellis < MIN_TRELLIS || avctx->trellis > MAX_TRELLIS) {
115 int new_trellis = av_clip(avctx->trellis, MIN_TRELLIS, MAX_TRELLIS);
116 av_log(avctx, AV_LOG_WARNING, "Requested trellis value is not "
118 avctx->trellis);
119 avctx->trellis = new_trellis;
125 g722_encode_close(avctx);
352 static int g722_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
355 G722Context *c = avctx->priv_data;
360 if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0)
365 if (avctx->trellis)
366 g722_encode_trellis(c, avctx->trellis, avpkt->data, nb_samples, samples);
377 avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);