[FFmpeg-devel] [PATCH 1/2] lavfi: port MP stereo3d filter

Paul B Mahol onemda at gmail.com
Mon Mar 4 20:50:46 CET 2013


On 3/3/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sun, Mar 03, 2013 at 12:53:05PM +0000, Paul B Mahol wrote:
> [...]
>> +static inline uint8_t ana_convert(int *coeff, uint8_t *left, uint8_t
>> *right)
>> +{
>> +    int sum;
>> +
>> +    sum  = coeff[0] * left[0] + coeff[3] * right[0]; //red in
>> +    sum += coeff[1] * left[1] + coeff[4] * right[1]; //green in
>> +    sum += coeff[2] * left[2] + coeff[5] * right[2]; //blue in
>> +
>> +    return av_clip_uint8(sum >> 16);
>> +}
>
> the rounding is biased toward 0

Point of this port patch is to produce bit-exact output which it does.

If one still want to improve something it can be done in later patches.

>
>
> [...]
>> +        int *ana_matrix[3];
>> +
>> +        for (i = 0; i < 3; i++)
>> +            ana_matrix[i] = s->ana_matrix[i];
>> +
>> +        for (y = 0; y < s->out.height; y++) {
>> +            o   = out->linesize[0] * y;
>> +            il  = in_off_left  + y * inpicref->linesize[0];
>> +            ir  = in_off_right + y * inpicref->linesize[0];
>
>> +            for (x = 0; x < out_width; x++, il += 3, ir += 3, o+= 3) {
>> +                dst[o    ] = ana_convert(ana_matrix[0], src + il, src +
>> ir);
>> +                dst[o + 1] = ana_convert(ana_matrix[1], src + il, src +
>> ir);
>> +                dst[o + 2] = ana_convert(ana_matrix[2], src + il, src +
>> ir);
>
> this could be speed up probably significantly if the constants where
> known at compiletime as they are often 0.0 or 1.0
> also the av_clip() is not needed in all cases

Yes, as above: to make some cases even faster it can be done
in another patch. Results of such optimization(s) can as usual
be in commit log.

>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The real ebay dictionary, page 1
> "Used only once"    - "Some unspecified defect prevented a second use"
> "In good condition" - "Can be repaird by experienced expert"
> "As is" - "You wouldnt want it even if you were payed for it, if you knew
> ..."
>


More information about the ffmpeg-devel mailing list