[Ffmpeg-cvslog] r5591 - trunk/libavcodec/vc1.c

Michael Niedermayer michaelni
Mon Jul 3 11:01:11 CEST 2006


Hi

On Mon, Jul 03, 2006 at 04:38:12AM +0200, kostya wrote:
> Author: kostya
> Date: Mon Jul  3 04:38:08 2006
> New Revision: 5591
> 
> Modified:
>    trunk/libavcodec/vc1.c
> 
> Log:
> 4-MV decoding support
> 
> 
> Modified: trunk/libavcodec/vc1.c
> ==============================================================================
> --- trunk/libavcodec/vc1.c	(original)
> +++ trunk/libavcodec/vc1.c	Mon Jul  3 04:38:08 2006
> @@ -288,6 +288,7 @@
>      int codingset2;       ///< index of current table set from 11.8 to use for chroma block decoding
>      int pqindex;          ///< raw pqindex used in coding set selection
>      int a_avail, c_avail;
> +    uint8_t *mb_type_base, *mb_type[3];
>  
>  
>      /** Luma compensation parameters */
> @@ -845,10 +846,10 @@
>          c = src[0];
>          d = src[stride];
>  
> -        src[-2*stride] = (7*a + d) >> 3;
> -        src[-stride] = (-a + 7*b + c + d) >> 3;
> -        src[0] = (a + b + 7*c - d) >> 3;
> -        src[stride] = (a + 7*d) >> 3;
> +        src[-2*stride] = clip_uint8((7*a + d + 3) >> 3);
> +        src[-stride] = clip_uint8((-a + 7*b + c + d + 3) >> 3);
> +        src[0] = clip_uint8((a + b + 7*c - d + 3) >> 3);
> +        src[stride] = clip_uint8((a + 7*d + 3) >> 3);

the rounding is wrong, it alternates betweem 3 and 4, also the input should
be the unclamped idct output not 8bit if i understand the spec correctly


[...]
> +#define SETMAXMIN(var)     \
> +    if(var > ma) ma = var; \
> +    if(var < mi) mi = var;
> +
> +static inline int median4(int a, int b, int c, int d)
> +{
> +    int ma, mi;
> +
> +    ma = mi = a;
> +    SETMAXMIN(b);
> +    SETMAXMIN(c);
> +    SETMAXMIN(d);
> +
> +    return (a + b + c + d - ma - mi) >> 1;

6 if, 5 add, 1 shift


if(a<b){
    if(c<d) return (FFMIN(b,d) + FFMAX(a,c))>>1;
    else    return (FFMIN(b,c) + FFMAX(a,d))>>1;
}else{
    if(c<d) return (FFMIN(a,d) + FFMAX(b,c))>>1;
    else    return (FFMIN(a,c) + FFMAX(b,d))>>1;
}

4 if, 1 add, 1 shift


[...]
> @@ -1276,6 +1416,48 @@
>          else mquant = get_bits(gb, 5);                         \
>        }                                                        \
>      }                                                          \
> +    else if(v->dqprofile == DQPROFILE_SINGLE_EDGE)             \
> +    {                                                          \
> +        switch(v->dqsbedge){                                   \
> +        case 0: /* left */                                     \
> +            mquant = (s->mb_x) ? v->pq : v->altpq;             \
> +            break;                                             \
> +        case 1: /* top */                                      \
> +            mquant = (s->mb_y) ? v->pq : v->altpq;             \
> +            break;                                             \
> +        case 2: /* right */                                    \
> +            mquant = (s->mb_x != (s->mb_width - 1)) ? v->pq : v->altpq; \
> +            break;                                             \
> +        case 3: /* bottom */                                   \
> +            mquant = (s->mb_y != (s->mb_height-1)) ? v->pq : v->altpq; \
> +            break;                                             \
> +        default:                                               \
> +            mquant = v->pq;                                    \
> +        }                                                      \
> +    }                                                          \
> +    else if(v->dqprofile == DQPROFILE_DOUBLE_EDGES)            \
> +    {                                                          \
> +        switch(v->dqsbedge){                                   \
> +        case 0: /* left and top */                             \
> +            mquant = (s->mb_x && s->mb_y) ? v->pq : v->altpq;  \
> +            break;                                             \
> +        case 1: /* top and right */                            \
> +            mquant = (s->mb_y && s->mb_x != (s->mb_width - 1)) ? v->pq : v->altpq; \
> +            break;                                             \
> +        case 2: /* right and bottom */                         \
> +            mquant = (s->mb_x != (s->mb_width - 1) && s->mb_y != (s->mb_height-1)) ? v->pq : v->altpq; \
> +            break;                                             \
> +        case 3: /* bottom and left */                          \
> +            mquant = (s->mb_x && s->mb_y != (s->mb_height-1)) ? v->pq : v->altpq; \
> +            break;                                             \
> +        default:                                               \
> +            mquant = v->pq;                                    \
> +        }                                                      \
> +    }                                                          \
> +    else if(v->dqprofile == DQPROFILE_FOUR_EDGES)              \
> +    {                                                          \
> +        mquant = (s->mb_x && s->mb_y && s->mb_x != (s->mb_width - 1) && s->mb_y != (s->mb_height-1)) ? v->pq : v->altpq; \
> +    }                                                          \
>      else mquant = v->pq;                                       \

if(v->dqprofile == DQPROFILE_SINGLE_EDGE)
    edges= 1<<v->dqsbedge;
else if(v->dqprofile == DQPROFILE_DOUBLE_EDGES)
    edges= (3<<v->dqsbedge) % 15;
else if(v->dqprofile == DQPROFILE_FOUR_EDGES)
    edges= 15;
else
    edges= 0;

mquant= v->pq;
if((edges&1) && !s->mb_x)
    mquant= v->altpq;
if((edges&2) && !s->mb_y)
    mquant= v->altpq;
if((edges&4) && s->mb_x == (s->mb_width - 1))
    mquant= v->altpq;
if((edges&8) && s->mb_y == (s->mb_height- 1))
    mquant= v->altpq;


[...]

> @@ -1695,7 +1911,6 @@
>      *dc_val = dcdiff;
>  
>      /* Store the quantized DC coeff, used for prediction */
> -
>      if (n < 4) {
>          block[0] = dcdiff * s->y_dc_scale;
>      } else {

cosmetic

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-cvslog mailing list