[FFmpeg-devel] Fwd: Re: Subject: [PATCH] Cleanup code in truemotion1 decoder

ffmpegandmahanstreamer at e.email ffmpegandmahanstreamer at e.email
Sat Aug 14 06:16:14 EEST 2021


Mike, i was told you can push this?

August 11, 2021 9:04 AM, ffmpegandmahanstreamer at e.email wrote:

> ping
> 
> August 1, 2021 12:22 PM, ffmpegandmahanstreamer at e.email wrote:
> 
>> Per Andreas Rheinhardt request i'm splitting the working patches in two.
>> ---
>> 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 | 36 ++++++++++++------------------------
>> 1 file changed, 12 insertions(+), 24 deletions(-)
>> 
>> diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
>> index 32d8fb4005..50c90e732d 100644
>> --- a/libavcodec/truemotion1.c
>> +++ b/libavcodec/truemotion1.c
>> @@ -655,25 +655,19 @@ static void truemotion1_decode_16bit(TrueMotion1Context *s)
>> while (pixels_left > 0) {
>> 
>> if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
>> -
>> +
>> switch (y & 3) {
>> 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_Y_PREDICTOR();
>> + OUTPUT_PIXEL_PAIR();
>> break;
>> 
>> case 1:
>> @@ -781,25 +775,19 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s)
>> while (pixels_left > 0) {
>> 
>> if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
>> -
>> +
>> switch (y & 3) {
>> 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:
>> --
>> 2.24.3


More information about the ffmpeg-devel mailing list