ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Wed Oct  4 16:14:40 2023 +0200| [1c40a179222f638e88c8e7b1a374753a00b0f979] | 
committer: Andreas Rheinhardt

avcodec/mpegpicture: Reduce value of MAX_PLANES define

No mpegvideo based codec supports alpha.
While just at it, also make the define shorter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

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

 libavcodec/mpegpicture.h   | 2 +-
 libavcodec/mpegvideo.h     | 2 +-
 libavcodec/mpegvideo_enc.c | 7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h
index 363732910a..8e3c119acc 100644
--- a/libavcodec/mpegpicture.h
+++ b/libavcodec/mpegpicture.h
@@ -27,7 +27,7 @@
 #include "motion_est.h"
 #include "threadframe.h"
 
-#define MPEGVIDEO_MAX_PLANES 4
+#define MPV_MAX_PLANES 3
 #define MAX_PICTURE_COUNT 36
 #define EDGE_WIDTH 16
 
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index e2953a3198..62550027a7 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -256,7 +256,7 @@ typedef struct MpegEncContext {
     uint8_t *mb_mean;           ///< Table for MB luminance
     int64_t mb_var_sum;         ///< sum of MB variance for current frame
     int64_t mc_mb_var_sum;      ///< motion compensated MB variance for 
current frame
-    uint64_t encoding_error[MPEGVIDEO_MAX_PLANES];
+    uint64_t encoding_error[MPV_MAX_PLANES];
 
     int motion_est;                      ///< ME algorithm
     int me_penalty_compensation;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index dabc1ee857..901293fda3 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1634,7 +1634,7 @@ no_output_pic:
         } else {
             // input is not a shared pix -> reuse buffer for current_pix
             s->cur_pic_ptr = s->reordered_input_picture[0];
-            for (i = 0; i < 4; i++) {
+            for (int i = 0; i < MPV_MAX_PLANES; i++) {
                 if (s->new_pic->data[i])
                     s->new_pic->data[i] += INPLACE_OFFSET;
             }
@@ -1861,12 +1861,11 @@ vbv_retry:
         if (avctx->flags & AV_CODEC_FLAG_PASS1)
             ff_write_pass1_stats(s);
 
-        for (i = 0; i < 4; i++) {
+        for (int i = 0; i < MPV_MAX_PLANES; i++)
             avctx->error[i] += s->encoding_error[i];
-        }
         ff_side_data_set_encoder_stats(pkt, s->cur_pic.f->quality,
                                        s->encoding_error,
-                                       (avctx->flags&AV_CODEC_FLAG_PSNR) ? 
MPEGVIDEO_MAX_PLANES : 0,
+                                       (avctx->flags&AV_CODEC_FLAG_PSNR) ? 
MPV_MAX_PLANES : 0,
                                        s->pict_type);
 
         if (avctx->flags & AV_CODEC_FLAG_PASS1)

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to