[FFmpeg-devel] avcodec/utvideoenc : add SIMD (SSSE3) for sub_left_pred
Henrik Gramner
henrik at gramner.com
Sun Jan 14 12:46:18 EET 2018
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.
> +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.
More information about the ffmpeg-devel
mailing list