Lines Matching defs:avctx
65 static int ljpeg_encode_bgr(AVCodecContext *avctx, PutBitContext *pb,
68 LJpegEncContext *s = avctx->priv_data;
84 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
92 if(avctx->pix_fmt == AV_PIX_FMT_BGR24){
100 if (avctx->pix_fmt == AV_PIX_FMT_BGRA)
104 for (i = 0; i < 3 + (avctx->pix_fmt == AV_PIX_FMT_BGRA); i++) {
192 static int ljpeg_encode_yuv(AVCodecContext *avctx, PutBitContext *pb,
195 LJpegEncContext *s = avctx->priv_data;
196 const int mb_width = (avctx->width + s->hsample[0] - 1) / s->hsample[0];
197 const int mb_height = (avctx->height + s->vsample[0] - 1) / s->vsample[0];
203 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
214 static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
217 LJpegEncContext *s = avctx->priv_data;
219 const int width = avctx->width;
220 const int height = avctx->height;
226 if( avctx->pix_fmt == AV_PIX_FMT_BGR0
227 || avctx->pix_fmt == AV_PIX_FMT_BGR24)
229 else if(avctx->pix_fmt == AV_PIX_FMT_BGRA)
236 if ((ret = ff_mjpeg_add_icc_profile_size(avctx, pict, &max_pkt_size)) < 0)
238 if ((ret = ff_alloc_packet(avctx, pkt, max_pkt_size)) < 0)
243 ff_mjpeg_encode_picture_header(avctx, &pb, pict, NULL, &s->scantable,
248 if( avctx->pix_fmt == AV_PIX_FMT_BGR0
249 || avctx->pix_fmt == AV_PIX_FMT_BGRA
250 || avctx->pix_fmt == AV_PIX_FMT_BGR24)
251 ret = ljpeg_encode_bgr(avctx, &pb, pict);
253 ret = ljpeg_encode_yuv(avctx, &pb, pict);
269 static av_cold int ljpeg_encode_close(AVCodecContext *avctx)
271 LJpegEncContext *s = avctx->priv_data;
278 static av_cold int ljpeg_encode_init(AVCodecContext *avctx)
280 int ret = ff_mjpeg_encode_check_pix_fmt(avctx);
281 LJpegEncContext *s = avctx->priv_data;
286 s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch));
290 ff_idctdsp_init(&s->idsp, avctx);
294 ff_mjpeg_init_hvsample(avctx, s->hsample, s->vsample);