[FFmpeg-devel] [PATCH] apng: Support inter-frame compression

Ronald S. Bultje rsbultje at gmail.com
Sun Jul 19 15:11:24 CEST 2015


Hi Donny,

On Sat, Jul 18, 2015 at 9:48 PM, Donny Yang <work at kota.moe> wrote:

> +    uint32_t x, y;
> +    uint32_t leftmost_x = input->width;
> +    uint32_t rightmost_x = 0;
> +    uint32_t topmost_y = input->height;
> +    uint32_t bottommost_y = 0;
> +    const uint8_t *input_data = input->data[0];
> +    uint8_t *output_data = output->data[0];
> +    size_t input_linesize = input->linesize[0];
> +    size_t output_linesize = output->linesize[0];
> +
> +    // Find bounding box of changes
> +    for (y = 0; y < input->height; ++y) {
> +        for (x = 0; x < input->width; ++x) {


These kind of variables should not be fixed-size (uintN_t), but should be
native-size (e.g. unsigned). In practice that means the same on most
machines (e.g. x86-32, x86-64), but on some machines unsigned will be
faster. uintN_t should only be used for arrays in which you want the size
to be exactly N bits, e.g. uint8_t pixeldata_8bits[w * h] or int16_t
pcmdata_16bits[n_samples * n_channels] or stuff like that. You don't care
that the counter is exactly 32bits.

(Related: linesize should be ptrdiff_t, not size_t.)

Ronald


More information about the ffmpeg-devel mailing list