Commit 54671902 authored by Ola Hugosson's avatar Ola Hugosson Committed by Ola Hugosson
Browse files

striped_loop_restoration bug fixes

* The above/below buffers did not fit the extra replication pixels to the right and left
* The wiener filter stripe has to be at least 4 pixel high (because of the
  split into above/mid/below parts)

Change-Id: I360bef114c7ceb439e11b76bd4724af15e051348
parent 1f8d0950
......@@ -156,7 +156,7 @@ void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
for (p = 0; p < MAX_MB_PLANE; ++p) {
int w = p == 0 ? width : ROUND_POWER_OF_TWO(width, cm->subsampling_x);
int align_bits = 5; // align for efficiency
int stride = ALIGN_POWER_OF_TWO(w, align_bits);
int stride = ALIGN_POWER_OF_TWO(w + 2 * RESTORATION_EXTRA_HORZ, align_bits);
int num_stripes = (height + 63) / 64;
// for each processing stripe: 2 lines above, 2 below
int buf_size = num_stripes * 2 * stride;
......@@ -186,6 +186,15 @@ void av1_free_restoration_buffers(AV1_COMMON *cm) {
av1_free_restoration_struct(&cm->rst_info[p]);
aom_free(cm->rst_tmpbuf);
cm->rst_tmpbuf = NULL;
#if CONFIG_STRIPED_LOOP_RESTORATION
for (p = 0; p < MAX_MB_PLANE; ++p) {
RestorationStripeBoundaries *boundaries = &cm->rst_info[p].boundaries;
aom_free(boundaries->stripe_boundary_above);
aom_free(boundaries->stripe_boundary_below);
boundaries->stripe_boundary_above = NULL;
boundaries->stripe_boundary_below = NULL;
}
#endif
}
#endif // CONFIG_LOOP_RESTORATION
......
......@@ -1376,7 +1376,8 @@ void av1_loop_restoration_filter_unit(const RestorationTileLimits *limits,
int h = setup_processing_stripe_boundary(&remaining_stripes, rsb,
procunit_height, ss_y, highbd,
data8, stride, rlbs);
if (unit_rtype == RESTORE_WIENER) h = ALIGN_POWER_OF_TWO(h, 1);
// The wiener filter needs a height>=4 in order to not assert on mid_height
if (unit_rtype == RESTORE_WIENER) h = ALIGN_POWER_OF_TWO(h, 2);
#else
const int h = AOMMIN(procunit_height, (unit_h - i + 15) & ~15);
#endif
......
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