[FFmpeg-devel] [PATCH v2 39/71] avcodec/mpegvideo_enc: Pass AVFrame*, not Picture* to alloc_picture()

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sat May 11 23:51:03 EEST 2024


It now only deals with the AVFrame and no longer with the accessories.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/mpegvideo_enc.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index d4b280da05..c6f4cd9b0e 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1091,30 +1091,30 @@ static int get_intra_count(MpegEncContext *s, const uint8_t *src,
     return acc;
 }
 
-static int alloc_picture(MpegEncContext *s, Picture *pic)
+static int alloc_picture(MpegEncContext *s, AVFrame *f)
 {
     AVCodecContext *avctx = s->avctx;
     int ret;
 
-    pic->f->width  = avctx->width  + 2 * EDGE_WIDTH;
-    pic->f->height = avctx->height + 2 * EDGE_WIDTH;
+    f->width  = avctx->width  + 2 * EDGE_WIDTH;
+    f->height = avctx->height + 2 * EDGE_WIDTH;
 
-    ret = ff_encode_alloc_frame(avctx, pic->f);
+    ret = ff_encode_alloc_frame(avctx, f);
     if (ret < 0)
         return ret;
 
-    ret = ff_mpv_pic_check_linesize(avctx, pic->f, &s->linesize, &s->uvlinesize);
+    ret = ff_mpv_pic_check_linesize(avctx, f, &s->linesize, &s->uvlinesize);
     if (ret < 0)
         return ret;
 
-    for (int i = 0; pic->f->data[i]; i++) {
+    for (int i = 0; f->data[i]; i++) {
         int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) *
-                     pic->f->linesize[i] +
+                     f->linesize[i] +
                      (EDGE_WIDTH >> (i ? s->chroma_x_shift : 0));
-        pic->f->data[i] += offset;
+        f->data[i] += offset;
     }
-    pic->f->width  = avctx->width;
-    pic->f->height = avctx->height;
+    f->width  = avctx->width;
+    f->height = avctx->height;
 
     return 0;
 }
@@ -1186,7 +1186,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
                 return ret;
             pic->shared = 1;
         } else {
-            ret = alloc_picture(s, pic);
+            ret = alloc_picture(s, pic->f);
             if (ret < 0)
                 goto fail;
             ret = av_frame_copy_props(pic->f, pic_arg);
@@ -1607,7 +1607,7 @@ no_output_pic:
             // input is a shared pix, so we can't modify it -> allocate a new
             // one & ensure that the shared one is reuseable
             av_frame_move_ref(s->new_pic, s->reordered_input_picture[0]->f);
-            ret = alloc_picture(s, s->reordered_input_picture[0]);
+            ret = alloc_picture(s, s->reordered_input_picture[0]->f);
             if (ret < 0)
                 goto fail;
 
-- 
2.40.1



More information about the ffmpeg-devel mailing list