[FFmpeg-devel] avcodec/utvideoenc : add SIMD (SSSE3) for sub_left_pred

James Almer jamrial at gmail.com
Sun Jan 14 13:55:09 EET 2018


On 1/14/2018 7:46 AM, Henrik Gramner wrote:
> On Sat, Jan 13, 2018 at 5:22 PM, Martin Vignali
> <martin.vignali at gmail.com> wrote:
>> +#define randomize_buffers(buf, size)     \
>> +    do {                                 \
>> +        int j;                           \
>> +        uint8_t *tmp_buf = (uint8_t *)buf;\
>> +        for (j = 0; j < size; j++)       \
>> +            tmp_buf[j] = rnd() & 0xFF;       \
>> +    } while (0)
> 
> Typecast is redundant since everything is already uint8_t (unless you
> plan to add more things that aren't).
> 
> & 0xFF is redundant for bytes.

AV_WN32 should be used here to write all four bytes instead of wasting
24 bits from every random value generated.

> 
>> +static void check_diff_bytes(LLVidEncDSPContext c)
> [...]
>> +static void check_sub_left_pred(LLVidEncDSPContext c)
> 
> Struct arguments should generallly be passed by reference (pointer).
> 
>> +    if (!dst0 || !dst1)
>> +        fail();
> [...]
>> +    if (!dst0 || !dst1 || !src0)
>> +        fail();
> 
> fail() is used to signal that the currently tested function has failed
> and shouldn't be used outside of the check_func() scope. In this case
> it wouldn't even prevent segfaults by dereferencing the NULL pointers
> anyway in case of malloc failure.
> 
> Actually, you could get rid of malloc and just use fixed-size stack
> buffers to simplify things.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 



More information about the ffmpeg-devel mailing list