On Fri, Jun 24, 2011 at 07:43:20AM -0700, Ronald S. Bultje wrote:
> This means that precision is retained when scaling between sample
> formats with >8 bits per component (48bit RGB, 16bit grayscale,
> 9/10/16bit YUV). Also document hscale functions.

This patch is laaaarge and could possibly be split, at least the
documentation bits could be separated.

> --- a/libswscale/ppc/swscale_altivec.c
> +++ b/libswscale/ppc/swscale_altivec.c
> @@ -407,7 +407,9 @@ void ff_sws_init_swScale_altivec(SwsContext *c)
>      if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
>          return;
>  
> +    if (c->scalingBpp == 8) {
>      c->hScale       = hScale_altivec_real;
> +    }

Just fix indentation right away, don't leave that single line for later.

> --- a/libswscale/swscale.c
> +++ b/libswscale/swscale.c
> @@ -2576,6 +2740,13 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
>  
> +    if (c->scalingBpp == 8) {
> +    c->hScale       = hScale_c;
> +    if (c->flags & SWS_FAST_BILINEAR) {
> +        c->hyscale_fast = hyscale_fast_c;
> +        c->hcscale_fast = hcscale_fast_c;
> +    }

indentation

Yes, you probably want to indent the whole block separately, but that
is - IMO - no reason to add the new lines wrongly indented.

> --- a/libswscale/swscale_internal.h
> +++ b/libswscale/swscale_internal.h
> @@ -390,6 +391,29 @@ typedef struct SwsContext {
> +
> +    /**
> +     * Scales one horizontal line of input data using a bilinear filter

Scale

> +     * to produce one line of output data. Compared to SwsContext->hScale(),
> +     * please take note of the following caveats when using these:
> +     * - scaling is done using only 7bit instead of 14bit coefficients
> +     * - you can use no more than 5 input pixels to produce 4 output
> +     *    pixels. Therefore, this filter should not be used for downscaling
> +     *    by more than ~20% in width (because that equals more than 5/4th
> +     *    downscaling and thus more than 5 pixels input per 4 pixels output).
> +     * - in general, bilinear filters create artifacts during downscaling
> +     *    (even when <20%), because one output pixel will span more than one
> +     *    input pixel, and thus some pixels will need edges of both neighbour

neighbor

> +     *    pixels to interpolate the output pixel. Since you can use at most
> +     *    two input pixels per output pixel in bilinear scaling, this is
> +     *    impossible and thus downscaling by any size will create artifacts.

Uppercase sentences in these three paragraphs, end in periods.
The extra space indentation looks a tad odd to me.

> +     * Really, the only reason this type of scaling (fast bilinear) exists
> +     * is because it allowed for certain types of mmx/mmx2 optimizations.

MMX/MMX2

> +     * In most practical cases, there is no reason to use this type of
> +     * scaling. To enable this type of scaling, set SWS_FLAG_FAST_BILINEAR
> +     * in SwsContext->flags.
> +     */
> +    /** @{ */
>      void (*hyscale_fast)(struct SwsContext *c,
>                           int16_t *dst, int dstWidth,
>                           const uint8_t *src, int srcW, int xInc);
> @@ -397,7 +421,34 @@ typedef struct SwsContext {
>  
> +    /**
> +     * Scales one horizontal line of input data using a filter over the input

Scale

I suggest that you push the documentation bits with the changes I
proposed right away.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to