On Tue, Jan 19, 2016 at 04:09:50PM -0500, Vittorio Giovara wrote:
> --- a/libavcodec/imgconvert.c
> +++ b/libavcodec/imgconvert.c
> @@ -160,92 +159,6 @@ enum AVPixelFormat avcodec_find_best_pix_fmt2(enum 
> AVPixelFormat *pix_fmt_list,
>  
> -/* 2x2 -> 1x1 */
> -void ff_shrink22(uint8_t *dst, int dst_wrap,
> -                     const uint8_t *src, int src_wrap,
> -                     int width, int height)
> -{
> -    int w;
> -    const uint8_t *s1, *s2;
> -    uint8_t *d;
> -
> -    for(;height > 0; height--) {
> -        s1 = src;
> -        s2 = s1 + src_wrap;
> -        d = dst;
> -        for(w = width;w >= 4; w-=4) {
> -            d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
> -            d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
> -            d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
> -            d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
> -            s1 += 8;
> -            s2 += 8;
> -            d += 4;
> -        }
> -        for(;w > 0; w--) {
> -            d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
> -            s1 += 2;
> -            s2 += 2;
> -            d++;
> -        }
> -        src += 2 * src_wrap;
> -        dst += dst_wrap;
> -    }
> -}
> --- a/libavcodec/mpegvideoencdsp.c
> +++ b/libavcodec/mpegvideoencdsp.c
> @@ -153,6 +152,93 @@ static void draw_edges_8_c(uint8_t *buf, int wrap, int 
> width, int height,
>  
> +/* 2x2 -> 1x1 */
> +static void shrink22(uint8_t *dst, int dst_wrap,
> +                     const uint8_t *src, int src_wrap,
> +                     int width, int height)
> +{
> +    int w;
> +    const uint8_t *s1, *s2;
> +    uint8_t *d;
> +
> +    for (; height > 0; height--) {
> +        s1 = src;
> +        s2 = s1 + src_wrap;
> +        d = dst;
> +        for (w = width; w >= 4; w -= 4) {
> +            d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
> +            d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
> +            d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
> +            d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
> +            s1 += 8;
> +            s2 += 8;
> +            d += 4;
> +        }
> +        for (; w > 0; w--) {
> +            d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
> +            s1 += 2;
> +            s2 += 2;
> +            d++;
> +        }
> +        src += 2 * src_wrap;
> +        dst += dst_wrap;
> +    }
> +}

You've reformatted the code while moving.  This is nice and all, but I fear
it might throw off the Git copy detection routines.  I would suggest doing
a reformatting as preliminary step instead.

> +/* 8x8 -> 1x1 */
> +static void shrink88(uint8_t *dst, int dst_wrap,
> +                     const uint8_t *src, int src_wrap,
> +                     int width, int height)
> +{
> +    int w, i;
> +
> +    for (; height > 0; height--) {
> +        for(w = width;w > 0; w--) {
> +            int tmp = 0;
> +            for (i = 0; i < 8; i++) {
> +                tmp += src[0] + src[1] + src[2] + src[3] +
> +                       src[4] + src[5] + src[6] + src[7];
> +                src += src_wrap;
> +            }
> +            *(dst++) = (tmp + 32)>>6;

spaces around >>

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

Reply via email to