[FFmpeg-devel] [PATCH] Port MPlayer 2xSaI filter to libavfilter
Nielkie
nielkie
Sat Nov 27 10:52:52 CET 2010
On Sat, Nov 27, 2010 at 2:42 AM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de>wrote:
> On Fri, Nov 26, 2010 at 06:45:38PM +1000, Nielkie wrote:
> > Yeah at the time it seemed like a good idea to reproduce the "quirks" of
> the
> > original code :\. Thanks, updated.
>
> Well, there is some advantage to porting the filters unchanged, but
> since the code was already quite far from that...
>
> > +static uint32_t readPixel(int bytesPerPixel, uint8_t *src, int offset)
>
> I'd say a "inline" might be advisable
>
>
Done
> > + switch(bytesPerPixel) {
> > + case 4:
> > + return AV_RN32A(src + 4*offset);
> > + case 3:
> > + return AV_RL24(src + 3*offset);
> > + case 2:
> > + return AV_RN16(src + 2*offset);
> > + }
> > + return 0;
>
> This should cause one useless branch, just to have a 0 return
> value in a case that should never happen.
>
>
What do you mean? The return 0 is just to avoid the compiler warning, but
isn't a branch inevitable?
> > +#define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B !=
> D))
> > +
> > +#define INTERPOLATE(A, B) (((A & c->colorMask) >> 1) + ((B &
> c->colorMask) >> 1) + (A & B & c->lowPixelMask))
> > +
> > +/* Interpolate two rgb colors with weights 3 and 1 */
> > +#define INTERPOLATE_3_1(A, B) ((A & c->qcolorMask) >> 2)*3 + ((B &
> c->qcolorMask) >> 2) \
> > + + ((((A & c->qlowPixelMask)*3 + (B &
> c->qlowPixelMask)) >> 2) & c->qlowPixelMask)
> > +
> > +/* Reads from the current source color neighborhood. */
> > +#define GET_COLOR(mx, my) (readPixel(c->bytesPerPixel, src_line[my],
> FFMIN(x+mx, width-1)))
>
> Macro arguments should be enclosed by () where "necessary". "Necessary"
> in this case means everywhere except the src_line[my] in this case.
> I suspect that a lot could be done for readability e.g. by using
> [4][4] instead of [16] for color, but maybe it's better to get it in first.
>
>
Done
-------------- next part --------------
A non-text attachment was scrubbed...
Name: super2xsai.diff
Type: application/octet-stream
Size: 14429 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101127/6ad010dc/attachment.obj>
More information about the ffmpeg-devel
mailing list