Commit 1522ca6c authored by Rupert Swarbrick's avatar Rupert Swarbrick Committed by Debargha Mukherjee

Fix placement of chroma LR coefficients in stream

The code was assuming that an mi was always 4 samples wide and
high. For chroma planes with subsampling, this is wrong and the size
and position of the sb in the plane was over-estimated by a factor of
two. This meant that we sent all the coefficients in the top-left hand
quarter of the tile. Since the encoder and decoder made the same
mistake, this worked fine, but it's clearly not what we're supposed to
do!

Change-Id: I0da8ada1d76639ad476ad84491658bc25ef3a43f
parent e6ab2257
......@@ -1864,6 +1864,12 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
const int horz_units = count_units_in_tile(size, tile_w);
const int vert_units = count_units_in_tile(size, tile_h);
// The size of an MI-unit on this plane of the image
const int ss_x = is_uv && cm->subsampling_x;
const int ss_y = is_uv && cm->subsampling_y;
const int mi_size_x = MI_SIZE >> ss_x;
const int mi_size_y = MI_SIZE >> ss_y;
#if CONFIG_FRAME_SUPERRES
// Write m for the relative mi column or row, D for the superres denominator
// and N for the superres numerator. If u is the upscaled (called "unscaled"
......@@ -1873,19 +1879,18 @@ int av1_loop_restoration_corners_in_sb(const struct AV1Common *cm, int plane,
// MI_SIZE * m = N / D u
//
// from which we get u = D * MI_SIZE * m / N
const int mi_to_num_x = MI_SIZE * cm->superres_scale_denominator;
const int mi_to_num_x = mi_size_x * cm->superres_scale_denominator;
const int mi_to_num_y =
mi_size_y *
(CONFIG_HORZONLY_FRAME_SUPERRES ? 1 : cm->superres_scale_denominator);
const int denom_x = size * SCALE_NUMERATOR;
const int denom_y = CONFIG_HORZONLY_FRAME_SUPERRES ? size : denom_x;
#else
const int mi_to_num_x = MI_SIZE;
const int mi_to_num_x = mi_size_x;
const int mi_to_num_y = mi_size_y;
const int denom_x = size;
#endif // CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SUPERRES && CONFIG_HORZONLY_FRAME_SUPERRES
const int mi_to_num_y = MI_SIZE;
const int denom_y = size;
#else
const int mi_to_num_y = mi_to_num_x;
const int denom_y = denom_x;
#endif // CONFIG_FRAME_SUPERRES && CONFIG_HORZONLY_FRAME_SUPERRES
#endif // CONFIG_FRAME_SUPERRES
const int rnd_x = denom_x - 1;
const int rnd_y = denom_y - 1;
......
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