[12/15] vc1dec: Fix lutuv use in vc1_mc_4mv_chroma4()

Message ID 1369729571-75967-12-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö May 28, 2013, 8:26 a.m.
From: Michael Niedermayer <michaelni@gmx.at>

---
 libavcodec/vc1dec.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Kostya Shishkov May 28, 2013, 10:12 a.m. | #1
On Tue, May 28, 2013 at 11:26:08AM +0300, Martin Storsjö wrote:
> From: Michael Niedermayer <michaelni@gmx.at>
> 
> ---
>  libavcodec/vc1dec.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> index 5e06dfd..10234c1 100644
> --- a/libavcodec/vc1dec.c
> +++ b/libavcodec/vc1dec.c
> @@ -1023,14 +1023,14 @@ static void vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg)
>              if (use_ic) {
>                  int i, j;
>                  uint8_t *src, *src2;
> -                const uint8_t *lutuv1 = lutuv[v->ref_field_type[i<2 ? dir : dir2]];
>  
>                  src  = srcU;
>                  src2 = srcV;
>                  for (j = 0; j < 5; j++) {
> +                    int f = (uvsrc_y + (j << fieldmv)) & 1;
>                      for (i = 0; i < 5; i++) {
> -                        src[i]  = lutuv1[src[i]];
> -                        src2[i] = lutuv1[src2[i]];
> +                        src[i]  = lutuv[f][src[i]];
> +                        src2[i] = lutuv[f][src2[i]];
>                      }
>                      src  += s->uvlinesize << fieldmv;
>                      src2 += s->uvlinesize << fieldmv;
> -- 

probably OK and a good candidate for squashing with the previous patch

Patch

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 5e06dfd..10234c1 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1023,14 +1023,14 @@  static void vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg)
             if (use_ic) {
                 int i, j;
                 uint8_t *src, *src2;
-                const uint8_t *lutuv1 = lutuv[v->ref_field_type[i<2 ? dir : dir2]];
 
                 src  = srcU;
                 src2 = srcV;
                 for (j = 0; j < 5; j++) {
+                    int f = (uvsrc_y + (j << fieldmv)) & 1;
                     for (i = 0; i < 5; i++) {
-                        src[i]  = lutuv1[src[i]];
-                        src2[i] = lutuv1[src2[i]];
+                        src[i]  = lutuv[f][src[i]];
+                        src2[i] = lutuv[f][src2[i]];
                     }
                     src  += s->uvlinesize << fieldmv;
                     src2 += s->uvlinesize << fieldmv;