libavcodec/vp9block.c:1294: error: Null Dereference
  pointer `ref2` last assigned on line 1229 could be null and is dereferenced at line 1294, column 29.

libavcodec/vp9block.c:1219:1: start of procedure inter_recon()
1217. }
1218. 
1219. static int inter_recon(AVCodecContext *avctx)
      ^
1220. {
1221.     static const uint8_t bwlog_tab[2][N_BS_SIZES] = {

libavcodec/vp9block.c:1221:5: 
1219. static int inter_recon(AVCodecContext *avctx)
1220. {
1221.     static const uint8_t bwlog_tab[2][N_BS_SIZES] = {
          ^
1222.         { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
1223.         { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },

libavcodec/vp9block.c:1225:5: 
1223.         { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },
1224.     };
1225.     VP9Context *s = avctx->priv_data;
          ^
1226.     VP9Block *const b = &s->b;
1227.     int row = b->row, col = b->col;

libavcodec/vp9block.c:1226:5: 
1224.     };
1225.     VP9Context *s = avctx->priv_data;
1226.     VP9Block *const b = &s->b;
          ^
1227.     int row = b->row, col = b->col;
1228.     AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]];

libavcodec/vp9block.c:1227:5: 
1225.     VP9Context *s = avctx->priv_data;
1226.     VP9Block *const b = &s->b;
1227.     int row = b->row, col = b->col;
          ^
1228.     AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]];
1229.     AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL;

libavcodec/vp9block.c:1228:5: 
1226.     VP9Block *const b = &s->b;
1227.     int row = b->row, col = b->col;
1228.     AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]];
          ^
1229.     AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL;
1230.     int w = avctx->width, h = avctx->height;

libavcodec/vp9block.c:1229:21: Condition is false
1227.     int row = b->row, col = b->col;
1228.     AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]];
1229.     AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL;
                          ^
1230.     int w = avctx->width, h = avctx->height;
1231.     ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride;

libavcodec/vp9block.c:1229:5: 
1227.     int row = b->row, col = b->col;
1228.     AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]];
1229.     AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL;
          ^
1230.     int w = avctx->width, h = avctx->height;
1231.     ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride;

libavcodec/vp9block.c:1230:5: 
1228.     AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]];
1229.     AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL;
1230.     int w = avctx->width, h = avctx->height;
          ^
1231.     ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride;
1232. 

libavcodec/vp9block.c:1231:5: 
1229.     AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL;
1230.     int w = avctx->width, h = avctx->height;
1231.     ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride;
          ^
1232. 
1233.     if (!ref1->data[0] || (b->comp && !ref2->data[0]))

libavcodec/vp9block.c:1233:10: Taking false branch
1231.     ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride;
1232. 
1233.     if (!ref1->data[0] || (b->comp && !ref2->data[0]))
               ^
1234.         return AVERROR_INVALIDDATA;
1235. 

libavcodec/vp9block.c:1233:28: Taking false branch
1231.     ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride;
1232. 
1233.     if (!ref1->data[0] || (b->comp && !ref2->data[0]))
                                 ^
1234.         return AVERROR_INVALIDDATA;
1235. 

libavcodec/vp9block.c:1237:9: Taking true branch
1235. 
1236.     // y inter pred
1237.     if (b->bs > BS_8x8) {
              ^
1238.         if (b->bs == BS_8x4) {
1239.             mc_luma_dir(s, s->dsp.mc[3][b->filter][0], b->dst[0], ls_y,

libavcodec/vp9block.c:1238:13: Taking false branch
1236.     // y inter pred
1237.     if (b->bs > BS_8x8) {
1238.         if (b->bs == BS_8x4) {
                  ^
1239.             mc_luma_dir(s, s->dsp.mc[3][b->filter][0], b->dst[0], ls_y,
1240.                         ref1->data[0], ref1->linesize[0],

libavcodec/vp9block.c:1256:20: Taking false branch
1254.                             (row << 3) + 4, col << 3, &b->mv[2][1], 8, 4, w, h);
1255.             }
1256.         } else if (b->bs == BS_4x8) {
                         ^
1257.             mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y,
1258.                         ref1->data[0], ref1->linesize[0],

libavcodec/vp9block.c:1273:13: 
1271.             }
1272.         } else {
1273.             av_assert2(b->bs == BS_4x4);
                  ^
1274. 
1275.             // FIXME if two horizontally adjacent blocks have the same MV,

libavcodec/vp9block.c:1277:13: Skipping mc_luma_dir(): empty list of specs
1275.             // FIXME if two horizontally adjacent blocks have the same MV,
1276.             // do a w8 instead of a w4 call
1277.             mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y,
                  ^
1278.                         ref1->data[0], ref1->linesize[0],
1279.                         row << 3, col << 3, &b->mv[0][0], 4, 4, w, h);

libavcodec/vp9block.c:1280:13: Skipping mc_luma_dir(): empty list of specs
1278.                         ref1->data[0], ref1->linesize[0],
1279.                         row << 3, col << 3, &b->mv[0][0], 4, 4, w, h);
1280.             mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4, ls_y,
                  ^
1281.                         ref1->data[0], ref1->linesize[0],
1282.                         row << 3, (col << 3) + 4, &b->mv[1][0], 4, 4, w, h);

libavcodec/vp9block.c:1283:13: Skipping mc_luma_dir(): empty list of specs
1281.                         ref1->data[0], ref1->linesize[0],
1282.                         row << 3, (col << 3) + 4, &b->mv[1][0], 4, 4, w, h);
1283.             mc_luma_dir(s, s->dsp.mc[4][b->filter][0],
                  ^
1284.                         b->dst[0] + 4 * ls_y, ls_y,
1285.                         ref1->data[0], ref1->linesize[0],

libavcodec/vp9block.c:1287:13: Skipping mc_luma_dir(): empty list of specs
1285.                         ref1->data[0], ref1->linesize[0],
1286.                         (row << 3) + 4, col << 3, &b->mv[2][0], 4, 4, w, h);
1287.             mc_luma_dir(s, s->dsp.mc[4][b->filter][0],
                  ^
1288.                         b->dst[0] + 4 * ls_y + 4, ls_y,
1289.                         ref1->data[0], ref1->linesize[0],

libavcodec/vp9block.c:1292:17: Taking true branch
1290.                         (row << 3) + 4, (col << 3) + 4, &b->mv[3][0], 4, 4, w, h);
1291. 
1292.             if (b->comp) {
                      ^
1293.                 mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y,
1294.                             ref2->data[0], ref2->linesize[0],

libavcodec/vp9block.c:1293:17: 
1291. 
1292.             if (b->comp) {
1293.                 mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y,
                      ^
1294.                             ref2->data[0], ref2->linesize[0],
1295.                             row << 3, col << 3, &b->mv[0][1], 4, 4, w, h);

static int inter_recon(AVCodecContext *avctx)
{
    static const uint8_t bwlog_tab[2][N_BS_SIZES] = {
        { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
        { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },
    };
    VP9Context *s = avctx->priv_data;
    VP9Block *const b = &s->b;
    int row = b->row, col = b->col;
    AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]];
    AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL;
    int w = avctx->width, h = avctx->height;
    ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride;
    if (!ref1->data[0] || (b->comp && !ref2->data[0]))
        return AVERROR_INVALIDDATA;
    if (b->bs > BS_8x8) {
        if (b->bs == BS_8x4) {
            mc_luma_dir(s, s->dsp.mc[3][b->filter][0], b->dst[0], ls_y,
                        ref1->data[0], ref1->linesize[0],
                        row << 3, col << 3, &b->mv[0][0], 8, 4, w, h);
            mc_luma_dir(s, s->dsp.mc[3][b->filter][0],
                        b->dst[0] + 4 * ls_y, ls_y,
                        ref1->data[0], ref1->linesize[0],
                        (row << 3) + 4, col << 3, &b->mv[2][0], 8, 4, w, h);
            if (b->comp) {
                mc_luma_dir(s, s->dsp.mc[3][b->filter][1], b->dst[0], ls_y,
                            ref2->data[0], ref2->linesize[0],
                            row << 3, col << 3, &b->mv[0][1], 8, 4, w, h);
                mc_luma_dir(s, s->dsp.mc[3][b->filter][1],
                            b->dst[0] + 4 * ls_y, ls_y,
                            ref2->data[0], ref2->linesize[0],
                            (row << 3) + 4, col << 3, &b->mv[2][1], 8, 4, w, h);
            }
        } else if (b->bs == BS_4x8) {
            mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y,
                        ref1->data[0], ref1->linesize[0],
                        row << 3, col << 3, &b->mv[0][0], 4, 8, w, h);
            mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4, ls_y,
                        ref1->data[0], ref1->linesize[0],
                        row << 3, (col << 3) + 4, &b->mv[1][0], 4, 8, w, h);
            if (b->comp) {
                mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y,
                            ref2->data[0], ref2->linesize[0],
                            row << 3, col << 3, &b->mv[0][1], 4, 8, w, h);
                mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0] + 4, ls_y,
                            ref2->data[0], ref2->linesize[0],
                            row << 3, (col << 3) + 4, &b->mv[1][1], 4, 8, w, h);
            }
        } else {
            av_assert2(b->bs == BS_4x4);
            mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y,
                        ref1->data[0], ref1->linesize[0],
                        row << 3, col << 3, &b->mv[0][0], 4, 4, w, h);
            mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4, ls_y,
                        ref1->data[0], ref1->linesize[0],
                        row << 3, (col << 3) + 4, &b->mv[1][0], 4, 4, w, h);
            mc_luma_dir(s, s->dsp.mc[4][b->filter][0],
                        b->dst[0] + 4 * ls_y, ls_y,
                        ref1->data[0], ref1->linesize[0],
                        (row << 3) + 4, col << 3, &b->mv[2][0], 4, 4, w, h);
            mc_luma_dir(s, s->dsp.mc[4][b->filter][0],
                        b->dst[0] + 4 * ls_y + 4, ls_y,
                        ref1->data[0], ref1->linesize[0],
                        (row << 3) + 4, (col << 3) + 4, &b->mv[3][0], 4, 4, w, h);
            if (b->comp) {
                mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y,
                            ref2->data[0], ref2->linesize[0],
                            row << 3, col << 3, &b->mv[0][1], 4, 4, w, h);
                mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0] + 4, ls_y,
                            ref2->data[0], ref2->linesize[0],
                            row << 3, (col << 3) + 4, &b->mv[1][1], 4, 4, w, h);
                mc_luma_dir(s, s->dsp.mc[4][b->filter][1],
                            b->dst[0] + 4 * ls_y, ls_y,
                            ref2->data[0], ref2->linesize[0],
                            (row << 3) + 4, col << 3, &b->mv[2][1], 4, 4, w, h);
                mc_luma_dir(s, s->dsp.mc[4][b->filter][1],
                            b->dst[0] + 4 * ls_y + 4, ls_y,
                            ref2->data[0], ref2->linesize[0],
                            (row << 3) + 4, (col << 3) + 4, &b->mv[3][1], 4, 4, w, h);
            }
        }
    } else {
        int bwl = bwlog_tab[0][b->bs];
        int bw  = bwh_tab[0][b->bs][0] * 4;
        int bh  = bwh_tab[0][b->bs][1] * 4;
        mc_luma_dir(s, s->dsp.mc[bwl][b->filter][0], b->dst[0], ls_y,
                    ref1->data[0], ref1->linesize[0],
                    row << 3, col << 3, &b->mv[0][0], bw, bh, w, h);
        if (b->comp)
            mc_luma_dir(s, s->dsp.mc[bwl][b->filter][1], b->dst[0], ls_y,
                        ref2->data[0], ref2->linesize[0],
                        row << 3, col << 3, &b->mv[0][1], bw, bh, w, h);
    }
    {
        int bwl = bwlog_tab[1][b->bs];
        int bw  = bwh_tab[1][b->bs][0] * 4, bh = bwh_tab[1][b->bs][1] * 4;
        VP56mv mvuv;
        w = (w + 1) >> 1;
        h = (h + 1) >> 1;
        if (b->bs > BS_8x8) {
            mvuv.x = ROUNDED_DIV(b->mv[0][0].x + b->mv[1][0].x +
                                 b->mv[2][0].x + b->mv[3][0].x, 4);
            mvuv.y = ROUNDED_DIV(b->mv[0][0].y + b->mv[1][0].y +
                                 b->mv[2][0].y + b->mv[3][0].y, 4);
        } else {
            mvuv = b->mv[0][0];
        }
        mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][0],
                      b->dst[1], b->dst[2], ls_uv,
                      ref1->data[1], ref1->linesize[1],
                      ref1->data[2], ref1->linesize[2],
                      row << 2, col << 2, &mvuv, bw, bh, w, h);
        if (b->comp) {
            if (b->bs > BS_8x8) {
                mvuv.x = ROUNDED_DIV(b->mv[0][1].x + b->mv[1][1].x +
                                     b->mv[2][1].x + b->mv[3][1].x, 4);
                mvuv.y = ROUNDED_DIV(b->mv[0][1].y + b->mv[1][1].y +
                                     b->mv[2][1].y + b->mv[3][1].y, 4);
            } else {
                mvuv = b->mv[0][1];
            }
            mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][1],
                          b->dst[1], b->dst[2], ls_uv,
                          ref2->data[1], ref2->linesize[1],
                          ref2->data[2], ref2->linesize[2],
                          row << 2, col << 2, &mvuv, bw, bh, w, h);
        }
    }
    if (!b->skip) {
        int w4 = bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n;
        int h4 = bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2);
        int end_x = FFMIN(2 * (s->cols - col), w4);
        int end_y = FFMIN(2 * (s->rows - row), h4);
        int tx = 4 * s->lossless + b->tx, uvtx = b->uvtx + 4 * s->lossless;
        int uvstep1d = 1 << b->uvtx, p;
        uint8_t *dst = b->dst[0];
        for (n = 0, y = 0; y < end_y; y += step1d) {
            uint8_t *ptr = dst;
            for (x = 0; x < end_x; x += step1d, ptr += 4 * step1d, n += step) {
                int eob = b->tx > TX_8X8 ? AV_RN16A(&s->eob[n]) : s->eob[n];
                if (eob)
                    s->dsp.itxfm_add[tx][DCT_DCT](ptr, b->y_stride,
                                                  s->block + 16 * n, eob);
            }
            dst += 4 * b->y_stride * step1d;
        }
        h4    >>= 1;
        w4    >>= 1;
        end_x >>= 1;
        end_y >>= 1;
        step    = 1 << (b->uvtx * 2);
        for (p = 0; p < 2; p++) {
            dst = b->dst[p + 1];
            for (n = 0, y = 0; y < end_y; y += uvstep1d) {
                uint8_t *ptr = dst;
                for (x = 0; x < end_x; x += uvstep1d, ptr += 4 * uvstep1d, n += step) {
                    int eob = b->uvtx > TX_8X8 ? AV_RN16A(&s->uveob[p][n])
                                               : s->uveob[p][n];
                    if (eob)
                        s->dsp.itxfm_add[uvtx][DCT_DCT](ptr, b->uv_stride,
                                                        s->uvblock[p] + 16 * n, eob);
                }
                dst += 4 * uvstep1d * b->uv_stride;
            }
        }
    }
    return 0;
}
['static int inter_recon(AVCodecContext *avctx)\n{\n    static const uint8_t bwlog_tab[2][N_BS_SIZES] = {\n        { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },\n        { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },\n    };\n    VP9Context *s = avctx->priv_data;\n    VP9Block *const b = &s->b;\n    int row = b->row, col = b->col;\n    AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]];\n    AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL;\n    int w = avctx->width, h = avctx->height;\n    ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride;\n    if (!ref1->data[0] || (b->comp && !ref2->data[0]))\n        return AVERROR_INVALIDDATA;\n    if (b->bs > BS_8x8) {\n        if (b->bs == BS_8x4) {\n            mc_luma_dir(s, s->dsp.mc[3][b->filter][0], b->dst[0], ls_y,\n                        ref1->data[0], ref1->linesize[0],\n                        row << 3, col << 3, &b->mv[0][0], 8, 4, w, h);\n            mc_luma_dir(s, s->dsp.mc[3][b->filter][0],\n                        b->dst[0] + 4 * ls_y, ls_y,\n                        ref1->data[0], ref1->linesize[0],\n                        (row << 3) + 4, col << 3, &b->mv[2][0], 8, 4, w, h);\n            if (b->comp) {\n                mc_luma_dir(s, s->dsp.mc[3][b->filter][1], b->dst[0], ls_y,\n                            ref2->data[0], ref2->linesize[0],\n                            row << 3, col << 3, &b->mv[0][1], 8, 4, w, h);\n                mc_luma_dir(s, s->dsp.mc[3][b->filter][1],\n                            b->dst[0] + 4 * ls_y, ls_y,\n                            ref2->data[0], ref2->linesize[0],\n                            (row << 3) + 4, col << 3, &b->mv[2][1], 8, 4, w, h);\n            }\n        } else if (b->bs == BS_4x8) {\n            mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y,\n                        ref1->data[0], ref1->linesize[0],\n                        row << 3, col << 3, &b->mv[0][0], 4, 8, w, h);\n            mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4, ls_y,\n                        ref1->data[0], ref1->linesize[0],\n                        row << 3, (col << 3) + 4, &b->mv[1][0], 4, 8, w, h);\n            if (b->comp) {\n                mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y,\n                            ref2->data[0], ref2->linesize[0],\n                            row << 3, col << 3, &b->mv[0][1], 4, 8, w, h);\n                mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0] + 4, ls_y,\n                            ref2->data[0], ref2->linesize[0],\n                            row << 3, (col << 3) + 4, &b->mv[1][1], 4, 8, w, h);\n            }\n        } else {\n            av_assert2(b->bs == BS_4x4);\n            mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y,\n                        ref1->data[0], ref1->linesize[0],\n                        row << 3, col << 3, &b->mv[0][0], 4, 4, w, h);\n            mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4, ls_y,\n                        ref1->data[0], ref1->linesize[0],\n                        row << 3, (col << 3) + 4, &b->mv[1][0], 4, 4, w, h);\n            mc_luma_dir(s, s->dsp.mc[4][b->filter][0],\n                        b->dst[0] + 4 * ls_y, ls_y,\n                        ref1->data[0], ref1->linesize[0],\n                        (row << 3) + 4, col << 3, &b->mv[2][0], 4, 4, w, h);\n            mc_luma_dir(s, s->dsp.mc[4][b->filter][0],\n                        b->dst[0] + 4 * ls_y + 4, ls_y,\n                        ref1->data[0], ref1->linesize[0],\n                        (row << 3) + 4, (col << 3) + 4, &b->mv[3][0], 4, 4, w, h);\n            if (b->comp) {\n                mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y,\n                            ref2->data[0], ref2->linesize[0],\n                            row << 3, col << 3, &b->mv[0][1], 4, 4, w, h);\n                mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0] + 4, ls_y,\n                            ref2->data[0], ref2->linesize[0],\n                            row << 3, (col << 3) + 4, &b->mv[1][1], 4, 4, w, h);\n                mc_luma_dir(s, s->dsp.mc[4][b->filter][1],\n                            b->dst[0] + 4 * ls_y, ls_y,\n                            ref2->data[0], ref2->linesize[0],\n                            (row << 3) + 4, col << 3, &b->mv[2][1], 4, 4, w, h);\n                mc_luma_dir(s, s->dsp.mc[4][b->filter][1],\n                            b->dst[0] + 4 * ls_y + 4, ls_y,\n                            ref2->data[0], ref2->linesize[0],\n                            (row << 3) + 4, (col << 3) + 4, &b->mv[3][1], 4, 4, w, h);\n            }\n        }\n    } else {\n        int bwl = bwlog_tab[0][b->bs];\n        int bw  = bwh_tab[0][b->bs][0] * 4;\n        int bh  = bwh_tab[0][b->bs][1] * 4;\n        mc_luma_dir(s, s->dsp.mc[bwl][b->filter][0], b->dst[0], ls_y,\n                    ref1->data[0], ref1->linesize[0],\n                    row << 3, col << 3, &b->mv[0][0], bw, bh, w, h);\n        if (b->comp)\n            mc_luma_dir(s, s->dsp.mc[bwl][b->filter][1], b->dst[0], ls_y,\n                        ref2->data[0], ref2->linesize[0],\n                        row << 3, col << 3, &b->mv[0][1], bw, bh, w, h);\n    }\n    {\n        int bwl = bwlog_tab[1][b->bs];\n        int bw  = bwh_tab[1][b->bs][0] * 4, bh = bwh_tab[1][b->bs][1] * 4;\n        VP56mv mvuv;\n        w = (w + 1) >> 1;\n        h = (h + 1) >> 1;\n        if (b->bs > BS_8x8) {\n            mvuv.x = ROUNDED_DIV(b->mv[0][0].x + b->mv[1][0].x +\n                                 b->mv[2][0].x + b->mv[3][0].x, 4);\n            mvuv.y = ROUNDED_DIV(b->mv[0][0].y + b->mv[1][0].y +\n                                 b->mv[2][0].y + b->mv[3][0].y, 4);\n        } else {\n            mvuv = b->mv[0][0];\n        }\n        mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][0],\n                      b->dst[1], b->dst[2], ls_uv,\n                      ref1->data[1], ref1->linesize[1],\n                      ref1->data[2], ref1->linesize[2],\n                      row << 2, col << 2, &mvuv, bw, bh, w, h);\n        if (b->comp) {\n            if (b->bs > BS_8x8) {\n                mvuv.x = ROUNDED_DIV(b->mv[0][1].x + b->mv[1][1].x +\n                                     b->mv[2][1].x + b->mv[3][1].x, 4);\n                mvuv.y = ROUNDED_DIV(b->mv[0][1].y + b->mv[1][1].y +\n                                     b->mv[2][1].y + b->mv[3][1].y, 4);\n            } else {\n                mvuv = b->mv[0][1];\n            }\n            mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][1],\n                          b->dst[1], b->dst[2], ls_uv,\n                          ref2->data[1], ref2->linesize[1],\n                          ref2->data[2], ref2->linesize[2],\n                          row << 2, col << 2, &mvuv, bw, bh, w, h);\n        }\n    }\n    if (!b->skip) {\n        int w4 = bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n;\n        int h4 = bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2);\n        int end_x = FFMIN(2 * (s->cols - col), w4);\n        int end_y = FFMIN(2 * (s->rows - row), h4);\n        int tx = 4 * s->lossless + b->tx, uvtx = b->uvtx + 4 * s->lossless;\n        int uvstep1d = 1 << b->uvtx, p;\n        uint8_t *dst = b->dst[0];\n        for (n = 0, y = 0; y < end_y; y += step1d) {\n            uint8_t *ptr = dst;\n            for (x = 0; x < end_x; x += step1d, ptr += 4 * step1d, n += step) {\n                int eob = b->tx > TX_8X8 ? AV_RN16A(&s->eob[n]) : s->eob[n];\n                if (eob)\n                    s->dsp.itxfm_add[tx][DCT_DCT](ptr, b->y_stride,\n                                                  s->block + 16 * n, eob);\n            }\n            dst += 4 * b->y_stride * step1d;\n        }\n        h4    >>= 1;\n        w4    >>= 1;\n        end_x >>= 1;\n        end_y >>= 1;\n        step    = 1 << (b->uvtx * 2);\n        for (p = 0; p < 2; p++) {\n            dst = b->dst[p + 1];\n            for (n = 0, y = 0; y < end_y; y += uvstep1d) {\n                uint8_t *ptr = dst;\n                for (x = 0; x < end_x; x += uvstep1d, ptr += 4 * uvstep1d, n += step) {\n                    int eob = b->uvtx > TX_8X8 ? AV_RN16A(&s->uveob[p][n])\n                                               : s->uveob[p][n];\n                    if (eob)\n                        s->dsp.itxfm_add[uvtx][DCT_DCT](ptr, b->uv_stride,\n                                                        s->uvblock[p] + 16 * n, eob);\n                }\n                dst += 4 * uvstep1d * b->uv_stride;\n            }\n        }\n    }\n    return 0;\n}']