[FFmpeg-cvslog] avcodec/mpegvideo_enc: Pass AVFrame*, not Picture* to alloc_picture()

Andreas Rheinhardt git at videolan.org
Wed Jun 12 14:15:46 EEST 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat Oct  7 21:37:42 2023 +0200| [8225d2da7390ac22cd9e93bb7b8711379ae36558] | committer: Andreas Rheinhardt

avcodec/mpegvideo_enc: Pass AVFrame*, not Picture* to alloc_picture()

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

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8225d2da7390ac22cd9e93bb7b8711379ae36558
---

 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 0b3eef646c..f54ec93cf2 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;
 



More information about the ffmpeg-cvslog mailing list