diff mbox series

[FFmpeg-devel,21/57] avcodec/mpegpicture: Reduce value of MAX_PLANES define

Message ID AS8P250MB0744430AC8A280C1524F4E0D8F1B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Superseded
Headers show
Series [FFmpeg-devel,01/14] avcodec/get_buffer: Remove redundant check | expand

Commit Message

Andreas Rheinhardt April 29, 2024, 9:14 p.m. UTC
No mpegvideo based codec supports alpha.
While just at it, also make the define shorter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegpicture.h   | 2 +-
 libavcodec/mpegvideo.h     | 2 +-
 libavcodec/mpegvideo_enc.c | 7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

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 57c1f7e423..bef7c399c2 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 63c280c2ba..47e97999af 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)