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

Michael Niedermayer michaelni at gmx.at
Sun Mar 3 21:33:08 CET 2013


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


[...]
> +        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

[...]
-- 
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 ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130303/d093f400/attachment.asc>


More information about the ffmpeg-devel mailing list