Fix the bug on 444 and 422 format Ported Yeqing's fix from libavm: https://gitlab.com/AOMediaCodec/avm/-/commit/2971c38bf521dda3d01d6101e6501648618bae46 STATS_CHANGED potentially for 422/444 Change-Id: Idad2fe0e60bae382658e4f809acad7f672012be4
diff --git a/aom_scale/aom_scale_rtcd.pl b/aom_scale/aom_scale_rtcd.pl index bcdb898..1f2df8d 100644 --- a/aom_scale/aom_scale_rtcd.pl +++ b/aom_scale/aom_scale_rtcd.pl
@@ -19,8 +19,6 @@ add_proto qw/int aom_yv12_realloc_with_new_border/, "struct yv12_buffer_config *ybf, int new_border, int byte_alignment, bool alloc_pyramid, int num_planes"; -add_proto qw/void aom_yv12_extend_frame_borders/, "struct yv12_buffer_config *ybf, const int num_planes"; - add_proto qw/void aom_yv12_copy_frame/, "const struct yv12_buffer_config *src_bc, struct yv12_buffer_config *dst_bc, const int num_planes"; add_proto qw/void aom_yv12_copy_y/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc, int use_crop";
diff --git a/aom_scale/generic/yv12extend.c b/aom_scale/generic/yv12extend.c index 019fbfb..8bc01f7 100644 --- a/aom_scale/generic/yv12extend.c +++ b/aom_scale/generic/yv12extend.c
@@ -144,42 +144,6 @@ extend_bottom_border ? bottom : 0, right, v_start, v_end); } -void aom_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf, - const int num_planes) { - assert(ybf->border % 2 == 0); - assert(ybf->y_height - ybf->y_crop_height < 16); - assert(ybf->y_width - ybf->y_crop_width < 16); - assert(ybf->y_height - ybf->y_crop_height >= 0); - assert(ybf->y_width - ybf->y_crop_width >= 0); - -#if CONFIG_AV1_HIGHBITDEPTH - if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) { - for (int plane = 0; plane < num_planes; ++plane) { - const int is_uv = plane > 0; - const int plane_border = ybf->border >> is_uv; - extend_plane_high( - ybf->buffers[plane], ybf->strides[is_uv], ybf->crop_widths[is_uv], - ybf->crop_heights[is_uv], plane_border, plane_border, - plane_border + ybf->heights[is_uv] - ybf->crop_heights[is_uv], - plane_border + ybf->widths[is_uv] - ybf->crop_widths[is_uv], 0, - ybf->crop_heights[is_uv]); - } - return; - } -#endif - - for (int plane = 0; plane < num_planes; ++plane) { - const int is_uv = plane > 0; - const int plane_border = ybf->border >> is_uv; - extend_plane(ybf->buffers[plane], ybf->strides[is_uv], - ybf->crop_widths[is_uv], ybf->crop_heights[is_uv], - plane_border, plane_border, - plane_border + ybf->heights[is_uv] - ybf->crop_heights[is_uv], - plane_border + ybf->widths[is_uv] - ybf->crop_widths[is_uv], 0, - ybf->crop_heights[is_uv]); - } -} - static void extend_frame(YV12_BUFFER_CONFIG *const ybf, int ext_size, const int num_planes) { const int ss_x = ybf->subsampling_x; @@ -254,7 +218,7 @@ plane_dst += dst_bc->strides[is_uv]; } } - aom_yv12_extend_frame_borders_c(dst_bc, num_planes); + aom_extend_frame_borders_c(dst_bc, num_planes); return; } #endif @@ -269,7 +233,7 @@ plane_dst += dst_bc->strides[is_uv]; } } - aom_yv12_extend_frame_borders_c(dst_bc, num_planes); + aom_extend_frame_borders_c(dst_bc, num_planes); } void aom_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc, @@ -482,9 +446,6 @@ // Copy image buffer aom_yv12_copy_frame(ybf, &new_buf, num_planes); - // Extend up to new border - aom_extend_frame_borders(&new_buf, num_planes); - // Now free the old buffer and replace with the new aom_free_frame_buffer(ybf); *ybf = new_buf;