Commit ed3e0cc7 authored by Ronald S. Bultje's avatar Ronald S. Bultje

vp9: take chroma subsampling into account when walking the block tree.

parent 6019002f
...@@ -3188,24 +3188,24 @@ static void decode_sb(AVCodecContext *ctx, int row, int col, struct VP9Filter *l ...@@ -3188,24 +3188,24 @@ static void decode_sb(AVCodecContext *ctx, int row, int col, struct VP9Filter *l
case PARTITION_H: case PARTITION_H:
decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp); decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
yoff += hbs * 8 * y_stride; yoff += hbs * 8 * y_stride;
uvoff += hbs * 4 * uv_stride; uvoff += hbs * 8 * uv_stride >> s->ss_v;
decode_b(ctx, row + hbs, col, lflvl, yoff, uvoff, bl, bp); decode_b(ctx, row + hbs, col, lflvl, yoff, uvoff, bl, bp);
break; break;
case PARTITION_V: case PARTITION_V:
decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp); decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
yoff += hbs * 8; yoff += hbs * 8;
uvoff += hbs * 4; uvoff += hbs * 8 >> s->ss_h;
decode_b(ctx, row, col + hbs, lflvl, yoff, uvoff, bl, bp); decode_b(ctx, row, col + hbs, lflvl, yoff, uvoff, bl, bp);
break; break;
case PARTITION_SPLIT: case PARTITION_SPLIT:
decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1); decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1);
decode_sb(ctx, row, col + hbs, lflvl, decode_sb(ctx, row, col + hbs, lflvl,
yoff + 8 * hbs, uvoff + 4 * hbs, bl + 1); yoff + 8 * hbs, uvoff + (8 * hbs >> s->ss_h), bl + 1);
yoff += hbs * 8 * y_stride; yoff += hbs * 8 * y_stride;
uvoff += hbs * 4 * uv_stride; uvoff += hbs * 8 * uv_stride >> s->ss_v;
decode_sb(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1); decode_sb(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
decode_sb(ctx, row + hbs, col + hbs, lflvl, decode_sb(ctx, row + hbs, col + hbs, lflvl,
yoff + 8 * hbs, uvoff + 4 * hbs, bl + 1); yoff + 8 * hbs, uvoff + (8 * hbs >> s->ss_h), bl + 1);
break; break;
default: default:
av_assert0(0); av_assert0(0);
...@@ -3214,7 +3214,7 @@ static void decode_sb(AVCodecContext *ctx, int row, int col, struct VP9Filter *l ...@@ -3214,7 +3214,7 @@ static void decode_sb(AVCodecContext *ctx, int row, int col, struct VP9Filter *l
bp = PARTITION_SPLIT; bp = PARTITION_SPLIT;
decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1); decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1);
decode_sb(ctx, row, col + hbs, lflvl, decode_sb(ctx, row, col + hbs, lflvl,
yoff + 8 * hbs, uvoff + 4 * hbs, bl + 1); yoff + 8 * hbs, uvoff + (8 * hbs >> s->ss_h), bl + 1);
} else { } else {
bp = PARTITION_H; bp = PARTITION_H;
decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp); decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
...@@ -3224,7 +3224,7 @@ static void decode_sb(AVCodecContext *ctx, int row, int col, struct VP9Filter *l ...@@ -3224,7 +3224,7 @@ static void decode_sb(AVCodecContext *ctx, int row, int col, struct VP9Filter *l
bp = PARTITION_SPLIT; bp = PARTITION_SPLIT;
decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1); decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1);
yoff += hbs * 8 * y_stride; yoff += hbs * 8 * y_stride;
uvoff += hbs * 4 * uv_stride; uvoff += hbs * 8 * uv_stride >> s->ss_v;
decode_sb(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1); decode_sb(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
} else { } else {
bp = PARTITION_V; bp = PARTITION_V;
...@@ -3253,11 +3253,11 @@ static void decode_sb_mem(AVCodecContext *ctx, int row, int col, struct VP9Filte ...@@ -3253,11 +3253,11 @@ static void decode_sb_mem(AVCodecContext *ctx, int row, int col, struct VP9Filte
decode_b(ctx, row, col, lflvl, yoff, uvoff, b->bl, b->bp); decode_b(ctx, row, col, lflvl, yoff, uvoff, b->bl, b->bp);
if (b->bp == PARTITION_H && row + hbs < s->rows) { if (b->bp == PARTITION_H && row + hbs < s->rows) {
yoff += hbs * 8 * y_stride; yoff += hbs * 8 * y_stride;
uvoff += hbs * 4 * uv_stride; uvoff += hbs * 8 * uv_stride >> s->ss_v;
decode_b(ctx, row + hbs, col, lflvl, yoff, uvoff, b->bl, b->bp); decode_b(ctx, row + hbs, col, lflvl, yoff, uvoff, b->bl, b->bp);
} else if (b->bp == PARTITION_V && col + hbs < s->cols) { } else if (b->bp == PARTITION_V && col + hbs < s->cols) {
yoff += hbs * 8; yoff += hbs * 8;
uvoff += hbs * 4; uvoff += hbs * 8 >> s->ss_h;
decode_b(ctx, row, col + hbs, lflvl, yoff, uvoff, b->bl, b->bp); decode_b(ctx, row, col + hbs, lflvl, yoff, uvoff, b->bl, b->bp);
} }
} else { } else {
...@@ -3265,20 +3265,20 @@ static void decode_sb_mem(AVCodecContext *ctx, int row, int col, struct VP9Filte ...@@ -3265,20 +3265,20 @@ static void decode_sb_mem(AVCodecContext *ctx, int row, int col, struct VP9Filte
if (col + hbs < s->cols) { // FIXME why not <=? if (col + hbs < s->cols) { // FIXME why not <=?
if (row + hbs < s->rows) { if (row + hbs < s->rows) {
decode_sb_mem(ctx, row, col + hbs, lflvl, yoff + 8 * hbs, decode_sb_mem(ctx, row, col + hbs, lflvl, yoff + 8 * hbs,
uvoff + 4 * hbs, bl + 1); uvoff + (8 * hbs >> s->ss_h), bl + 1);
yoff += hbs * 8 * y_stride; yoff += hbs * 8 * y_stride;
uvoff += hbs * 4 * uv_stride; uvoff += hbs * 8 * uv_stride >> s->ss_v;
decode_sb_mem(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1); decode_sb_mem(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
decode_sb_mem(ctx, row + hbs, col + hbs, lflvl, decode_sb_mem(ctx, row + hbs, col + hbs, lflvl,
yoff + 8 * hbs, uvoff + 4 * hbs, bl + 1); yoff + 8 * hbs, uvoff + (8 * hbs >> s->ss_h), bl + 1);
} else { } else {
yoff += hbs * 8; yoff += hbs * 8;
uvoff += hbs * 4; uvoff += hbs * 8 >> s->ss_h;
decode_sb_mem(ctx, row, col + hbs, lflvl, yoff, uvoff, bl + 1); decode_sb_mem(ctx, row, col + hbs, lflvl, yoff, uvoff, bl + 1);
} }
} else if (row + hbs < s->rows) { } else if (row + hbs < s->rows) {
yoff += hbs * 8 * y_stride; yoff += hbs * 8 * y_stride;
uvoff += hbs * 4 * uv_stride; uvoff += hbs * 8 * uv_stride >> s->ss_v;
decode_sb_mem(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1); decode_sb_mem(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
} }
} }
...@@ -3950,7 +3950,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame, ...@@ -3950,7 +3950,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame,
} }
for (row = s->tiling.tile_row_start; row < s->tiling.tile_row_end; for (row = s->tiling.tile_row_start; row < s->tiling.tile_row_end;
row += 8, yoff += ls_y * 64, uvoff += ls_uv * 32) { row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >> s->ss_v) {
struct VP9Filter *lflvl_ptr = s->lflvl; struct VP9Filter *lflvl_ptr = s->lflvl;
ptrdiff_t yoff2 = yoff, uvoff2 = uvoff; ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
...@@ -3975,7 +3975,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame, ...@@ -3975,7 +3975,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame,
for (col = s->tiling.tile_col_start; for (col = s->tiling.tile_col_start;
col < s->tiling.tile_col_end; col < s->tiling.tile_col_end;
col += 8, yoff2 += 64, uvoff2 += 32, lflvl_ptr++) { col += 8, yoff2 += 64, uvoff2 += 64 >> s->ss_h, lflvl_ptr++) {
// FIXME integrate with lf code (i.e. zero after each // FIXME integrate with lf code (i.e. zero after each
// use, similar to invtxfm coefficients, or similar) // use, similar to invtxfm coefficients, or similar)
if (s->pass != 1) { if (s->pass != 1) {
...@@ -4006,11 +4006,11 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame, ...@@ -4006,11 +4006,11 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame,
f->data[0] + yoff + 63 * ls_y, f->data[0] + yoff + 63 * ls_y,
8 * s->cols); 8 * s->cols);
memcpy(s->intra_pred_data[1], memcpy(s->intra_pred_data[1],
f->data[1] + uvoff + 31 * ls_uv, f->data[1] + uvoff + ((64 >> s->ss_v) - 1) * ls_uv,
4 * s->cols); 8 * s->cols >> s->ss_h);
memcpy(s->intra_pred_data[2], memcpy(s->intra_pred_data[2],
f->data[2] + uvoff + 31 * ls_uv, f->data[2] + uvoff + ((64 >> s->ss_v) - 1) * ls_uv,
4 * s->cols); 8 * s->cols >> s->ss_h);
} }
// loopfilter one row // loopfilter one row
...@@ -4019,7 +4019,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame, ...@@ -4019,7 +4019,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame,
uvoff2 = uvoff; uvoff2 = uvoff;
lflvl_ptr = s->lflvl; lflvl_ptr = s->lflvl;
for (col = 0; col < s->cols; for (col = 0; col < s->cols;
col += 8, yoff2 += 64, uvoff2 += 32, lflvl_ptr++) { col += 8, yoff2 += 64, uvoff2 += 64 >> s->ss_h, lflvl_ptr++) {
loopfilter_sb(ctx, lflvl_ptr, row, col, yoff2, uvoff2); loopfilter_sb(ctx, lflvl_ptr, row, col, yoff2, uvoff2);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment