diff mbox series

[FFmpeg-devel] Cleanup prediction code in truemotion1_decode_16bit and truemotion1_decode_24bit of truemotion1 decoder

Message ID 7ec1ea95c3bee3d38e8c5c4995ae68db@e.email
State New
Headers show
Series [FFmpeg-devel] Cleanup prediction code in truemotion1_decode_16bit and truemotion1_decode_24bit of truemotion1 decoder | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Mapul Bhola Aug. 14, 2021, 11:24 a.m. UTC
This cleans up the code in the decode24bit and decode16bit functions by putting it in way that expresses the true intent while making it easier to read.
---
 libavcodec/truemotion1.c | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

Comments

Mapul Bhola Aug. 14, 2021, 11:30 a.m. UTC | #1
The other patch has more subject line aligned to other devs, go to that one instead.

August 14, 2021 7:24 AM, "ffmpegandmahanstreamer" <ffmpegandmahanstreamer@e.email> wrote:

> This cleans up the code in the decode24bit and decode16bit functions by putting it in way that
> expresses the true intent while making it easier to read.
> ---
> libavcodec/truemotion1.c | 35 ++++++++++++-----------------------
> 1 file changed, 12 insertions(+), 23 deletions(-)
> 
> diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
> index 32d8fb4005..3f13de0ff8 100644
> --- a/libavcodec/truemotion1.c
> +++ b/libavcodec/truemotion1.c
> @@ -660,20 +660,14 @@ static void truemotion1_decode_16bit(TrueMotion1Context *s)
> case 0:
> /* if macroblock width is 2, apply C-Y-C-Y; else
> * apply C-Y-Y */
> + APPLY_C_PREDICTOR();
> + APPLY_Y_PREDICTOR();
> + OUTPUT_PIXEL_PAIR();
> if (s->block_width == 2) {
> - APPLY_C_PREDICTOR();
> - APPLY_Y_PREDICTOR();
> - OUTPUT_PIXEL_PAIR();
> - APPLY_C_PREDICTOR();
> - APPLY_Y_PREDICTOR();
> - OUTPUT_PIXEL_PAIR();
> - } else {
> - APPLY_C_PREDICTOR();
> - APPLY_Y_PREDICTOR();
> - OUTPUT_PIXEL_PAIR();
> - APPLY_Y_PREDICTOR();
> - OUTPUT_PIXEL_PAIR();
> + APPLY_C_PREDICTOR();
> }
> + APPLY_Y_PREDICTOR();
> + OUTPUT_PIXEL_PAIR();
> break;
> 
> case 1:
> @@ -786,22 +780,17 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s)
> case 0:
> /* if macroblock width is 2, apply C-Y-C-Y; else
> * apply C-Y-Y */
> + APPLY_C_PREDICTOR_24();
> + APPLY_Y_PREDICTOR_24();
> + OUTPUT_PIXEL_PAIR();
> if (s->block_width == 2) {
> APPLY_C_PREDICTOR_24();
> - APPLY_Y_PREDICTOR_24();
> - OUTPUT_PIXEL_PAIR();
> - APPLY_C_PREDICTOR_24();
> - APPLY_Y_PREDICTOR_24();
> - OUTPUT_PIXEL_PAIR();
> - } else {
> - APPLY_C_PREDICTOR_24();
> - APPLY_Y_PREDICTOR_24();
> - OUTPUT_PIXEL_PAIR();
> - APPLY_Y_PREDICTOR_24();
> - OUTPUT_PIXEL_PAIR();
> }
> + APPLY_Y_PREDICTOR_24();
> + OUTPUT_PIXEL_PAIR();
> break;
> 
> +
> case 1:
> case 3:
> /* always apply 2 Y predictors on these iterations */
> -- 
> 2.24.3
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index 32d8fb4005..3f13de0ff8 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -660,20 +660,14 @@  static void truemotion1_decode_16bit(TrueMotion1Context *s)
                 case 0:
                     /* if macroblock width is 2, apply C-Y-C-Y; else
                      * apply C-Y-Y */
+                    APPLY_C_PREDICTOR();
+                    APPLY_Y_PREDICTOR();
+                    OUTPUT_PIXEL_PAIR();
                     if (s->block_width == 2) {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
+                       APPLY_C_PREDICTOR();
                     }
+                    APPLY_Y_PREDICTOR();
+                    OUTPUT_PIXEL_PAIR();
                     break;
 
                 case 1:
@@ -786,22 +780,17 @@  static void truemotion1_decode_24bit(TrueMotion1Context *s)
                 case 0:
                     /* if macroblock width is 2, apply C-Y-C-Y; else
                      * apply C-Y-Y */
+                    APPLY_C_PREDICTOR_24();
+                    APPLY_Y_PREDICTOR_24();
+                    OUTPUT_PIXEL_PAIR();
                     if (s->block_width == 2) {
                         APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
                     }
+                    APPLY_Y_PREDICTOR_24();
+                    OUTPUT_PIXEL_PAIR();
                     break;
 
+
                 case 1:
                 case 3:
                     /* always apply 2 Y predictors on these iterations */