Message ID | 5e24723d1fe7ac807231fc631fbd6455@e.email |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v2] avcodec/truemotion1: Cleanup prediction code in truemotion1_decode_16bit and truemotion1_decode_24bit | expand |
Context | Check | Description |
---|---|---|
andriy/commit_msg_x86 | warning | Please wrap lines in the body of the commit message between 60 and 72 characters. |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | fail | Make fate failed |
andriy/commit_msg_ppc | warning | Please wrap lines in the body of the commit message between 60 and 72 characters. |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | fail | Make fate failed |
September 3, 2021 8:23 PM, "Mapul Bhola" <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 | 40 +++++++++++++--------------------------- > 1 file changed, 13 insertions(+), 27 deletions(-) > > diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c > index 32d8fb4005..9afe3f579d 100644 > --- a/libavcodec/truemotion1.c > +++ b/libavcodec/truemotion1.c > @@ -660,20 +660,13 @@ static void truemotion1_decode_16bit(TrueMotion1Context *s) > case 0: > /* if macroblock width is 2, apply C-Y-C-Y; else > * apply C-Y-Y */ > - 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(); > + if (s->block_width == 2) > + APPLY_C_PREDICTOR(); > + APPLY_Y_PREDICTOR(); > + OUTPUT_PIXEL_PAIR(); > break; > > case 1: > @@ -786,20 +779,13 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) > case 0: > /* if macroblock width is 2, apply C-Y-C-Y; else > * apply C-Y-Y */ > - 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(); > + if (s->block_width == 2) > 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: > -- > 2.24.3 ping
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index 32d8fb4005..9afe3f579d 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -660,20 +660,13 @@ static void truemotion1_decode_16bit(TrueMotion1Context *s) case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ - 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(); + if (s->block_width == 2) + APPLY_C_PREDICTOR(); + APPLY_Y_PREDICTOR(); + OUTPUT_PIXEL_PAIR(); break; case 1: @@ -786,20 +779,13 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ - 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(); + if (s->block_width == 2) 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: