diff mbox series

[FFmpeg-devel,54/57] avcodec/mpegvideo: Join loops when initializing ScanTable

Message ID GV1P250MB073737066049806865415C828FC02@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,01/57] avcodec/vc1: Combine identical checks | expand

Commit Message

Andreas Rheinhardt June 12, 2024, 1:48 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegvideo.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 27f7ebf933..4b5b864b83 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -296,20 +296,13 @@  static av_cold void dsp_init(MpegEncContext *s)
 av_cold void ff_init_scantable(const uint8_t *permutation, ScanTable *st,
                                const uint8_t *src_scantable)
 {
-    int end;
-
     st->scantable = src_scantable;
 
-    for (int i = 0; i < 64; i++) {
+    for (int i = 0, end = -1; i < 64; i++) {
         int j = src_scantable[i];
         st->permutated[i] = permutation[j];
-    }
-
-    end = -1;
-    for (int i = 0; i < 64; i++) {
-        int j = st->permutated[i];
-        if (j > end)
-            end = j;
+        if (permutation[j] > end)
+            end = permutation[j];
         st->raster_end[i] = end;
     }
 }