Fix vp8 race when build --enable-vp9-highbitdepth.

Split vp8/vp9 implementations on yv12_copy_frame_c.
Remove high-bitdepth codes from vp8_yv12_extend_frame_borders_c.
Clean up vp8 codes usage in vp9.

BUG=webm:1435

Change-Id: Ic68e79e9d71e1b20ddfc451fb8dcf2447861236d
This commit is contained in:
Jerome Jiang 2017-05-19 17:07:09 -07:00
parent b5055002d7
commit 0afa2dad76
6 changed files with 68 additions and 33 deletions

View File

@ -52,11 +52,19 @@ vpx_tsvc_encoder() {
# TODO(tomfinegan): Verify file output for all thread runs. # TODO(tomfinegan): Verify file output for all thread runs.
for threads in $(seq $max_threads); do for threads in $(seq $max_threads); do
eval "${VPX_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT}" "${output_file}" \ if [ "$(vpx_config_option_enabled CONFIG_VP9_HIGHBITDEPTH)" != "yes" ]; then
"${codec}" "${YUV_RAW_INPUT_WIDTH}" "${YUV_RAW_INPUT_HEIGHT}" \ eval "${VPX_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT}" \
"${timebase_num}" "${timebase_den}" "${speed}" "${frame_drop_thresh}" \ "${output_file}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
"${error_resilient}" "${threads}" "$@" \ "${YUV_RAW_INPUT_HEIGHT}" "${timebase_num}" "${timebase_den}" \
${devnull} "${speed}" "${frame_drop_thresh}" "${error_resilient}" "${threads}" \
"$@" ${devnull}
else
eval "${VPX_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT}" \
"${output_file}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
"${YUV_RAW_INPUT_HEIGHT}" "${timebase_num}" "${timebase_den}" \
"${speed}" "${frame_drop_thresh}" "${error_resilient}" "${threads}" \
"$@" "8" ${devnull}
fi
done done
} }

View File

@ -380,7 +380,7 @@ int vp9_post_proc_frame(struct VP9Common *cm, YV12_BUFFER_CONFIG *dest,
// if mfqe is enabled. Need to take both the quality and the speed // if mfqe is enabled. Need to take both the quality and the speed
// into consideration. // into consideration.
if ((flags & VP9D_DEMACROBLOCK) || (flags & VP9D_DEBLOCK)) { if ((flags & VP9D_DEMACROBLOCK) || (flags & VP9D_DEBLOCK)) {
vp8_yv12_copy_frame(ppbuf, &cm->post_proc_buffer_int); vpx_yv12_copy_frame(ppbuf, &cm->post_proc_buffer_int);
} }
if ((flags & VP9D_DEMACROBLOCK) && cm->post_proc_buffer_int.buffer_alloc) { if ((flags & VP9D_DEMACROBLOCK) && cm->post_proc_buffer_int.buffer_alloc) {
deblock_and_de_macro_block(&cm->post_proc_buffer_int, ppbuf, deblock_and_de_macro_block(&cm->post_proc_buffer_int, ppbuf,
@ -390,7 +390,7 @@ int vp9_post_proc_frame(struct VP9Common *cm, YV12_BUFFER_CONFIG *dest,
vp9_deblock(&cm->post_proc_buffer_int, ppbuf, q, vp9_deblock(&cm->post_proc_buffer_int, ppbuf, q,
cm->postproc_state.limits); cm->postproc_state.limits);
} else { } else {
vp8_yv12_copy_frame(&cm->post_proc_buffer_int, ppbuf); vpx_yv12_copy_frame(&cm->post_proc_buffer_int, ppbuf);
} }
} else if (flags & VP9D_DEMACROBLOCK) { } else if (flags & VP9D_DEMACROBLOCK) {
deblock_and_de_macro_block(cm->frame_to_show, ppbuf, deblock_and_de_macro_block(cm->frame_to_show, ppbuf,
@ -399,7 +399,7 @@ int vp9_post_proc_frame(struct VP9Common *cm, YV12_BUFFER_CONFIG *dest,
} else if (flags & VP9D_DEBLOCK) { } else if (flags & VP9D_DEBLOCK) {
vp9_deblock(cm->frame_to_show, ppbuf, q, cm->postproc_state.limits); vp9_deblock(cm->frame_to_show, ppbuf, q, cm->postproc_state.limits);
} else { } else {
vp8_yv12_copy_frame(cm->frame_to_show, ppbuf); vpx_yv12_copy_frame(cm->frame_to_show, ppbuf);
} }
ppstate->last_base_qindex = cm->base_qindex; ppstate->last_base_qindex = cm->base_qindex;

View File

@ -169,7 +169,7 @@ vpx_codec_err_t vp9_copy_reference_dec(VP9Decoder *pbi,
vpx_internal_error(&cm->error, VPX_CODEC_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
"Incorrect buffer dimensions"); "Incorrect buffer dimensions");
else else
vp8_yv12_copy_frame(cfg, sd); vpx_yv12_copy_frame(cfg, sd);
} else { } else {
vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "Invalid reference frame"); vpx_internal_error(&cm->error, VPX_CODEC_ERROR, "Invalid reference frame");
} }
@ -217,7 +217,7 @@ vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
"Incorrect buffer dimensions"); "Incorrect buffer dimensions");
} else { } else {
// Overwrite the reference frame buffer. // Overwrite the reference frame buffer.
vp8_yv12_copy_frame(sd, ref_buf); vpx_yv12_copy_frame(sd, ref_buf);
} }
return cm->error.error_code; return cm->error.error_code;

View File

@ -2557,7 +2557,7 @@ int vp9_copy_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd) { YV12_BUFFER_CONFIG *sd) {
YV12_BUFFER_CONFIG *cfg = get_vp9_ref_frame_buffer(cpi, ref_frame_flag); YV12_BUFFER_CONFIG *cfg = get_vp9_ref_frame_buffer(cpi, ref_frame_flag);
if (cfg) { if (cfg) {
vp8_yv12_copy_frame(cfg, sd); vpx_yv12_copy_frame(cfg, sd);
return 0; return 0;
} else { } else {
return -1; return -1;
@ -2568,7 +2568,7 @@ int vp9_set_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd) { YV12_BUFFER_CONFIG *sd) {
YV12_BUFFER_CONFIG *cfg = get_vp9_ref_frame_buffer(cpi, ref_frame_flag); YV12_BUFFER_CONFIG *cfg = get_vp9_ref_frame_buffer(cpi, ref_frame_flag);
if (cfg) { if (cfg) {
vp8_yv12_copy_frame(sd, cfg); vpx_yv12_copy_frame(sd, cfg);
return 0; return 0;
} else { } else {
return -1; return -1;

View File

@ -111,25 +111,6 @@ void vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
assert(ybf->y_height - ybf->y_crop_height >= 0); assert(ybf->y_height - ybf->y_crop_height >= 0);
assert(ybf->y_width - ybf->y_crop_width >= 0); assert(ybf->y_width - ybf->y_crop_width >= 0);
#if CONFIG_VP9_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
extend_plane_high(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_crop_height, ybf->border, ybf->border,
ybf->border + ybf->y_height - ybf->y_crop_height,
ybf->border + ybf->y_width - ybf->y_crop_width);
extend_plane_high(ybf->u_buffer, ybf->uv_stride, ybf->uv_crop_width,
ybf->uv_crop_height, uv_border, uv_border,
uv_border + ybf->uv_height - ybf->uv_crop_height,
uv_border + ybf->uv_width - ybf->uv_crop_width);
extend_plane_high(ybf->v_buffer, ybf->uv_stride, ybf->uv_crop_width,
ybf->uv_crop_height, uv_border, uv_border,
uv_border + ybf->uv_height - ybf->uv_crop_height,
uv_border + ybf->uv_width - ybf->uv_crop_width);
return;
}
#endif
extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width, extend_plane(ybf->y_buffer, ybf->y_stride, ybf->y_crop_width,
ybf->y_crop_height, ybf->border, ybf->border, ybf->y_crop_height, ybf->border, ybf->border,
ybf->border + ybf->y_height - ybf->y_crop_height, ybf->border + ybf->y_height - ybf->y_crop_height,
@ -208,12 +189,55 @@ static void memcpy_short_addr(uint8_t *dst8, const uint8_t *src8, int num) {
// Copies the source image into the destination image and updates the // Copies the source image into the destination image and updates the
// destination's UMV borders. // destination's UMV borders.
// Note: The frames are assumed to be identical in size. // Note: The frames are assumed to be identical in size.
void vp8_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc, void vp8_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc,
YV12_BUFFER_CONFIG *dst_ybc) { YV12_BUFFER_CONFIG *dst_ybc) {
int row; int row;
const uint8_t *src = src_ybc->y_buffer; const uint8_t *src = src_ybc->y_buffer;
uint8_t *dst = dst_ybc->y_buffer; uint8_t *dst = dst_ybc->y_buffer;
#if 0
/* These assertions are valid in the codec, but the libvpx-tester uses
* this code slightly differently.
*/
assert(src_ybc->y_width == dst_ybc->y_width);
assert(src_ybc->y_height == dst_ybc->y_height);
#endif
for (row = 0; row < src_ybc->y_height; ++row) {
memcpy(dst, src, src_ybc->y_width);
src += src_ybc->y_stride;
dst += dst_ybc->y_stride;
}
src = src_ybc->u_buffer;
dst = dst_ybc->u_buffer;
for (row = 0; row < src_ybc->uv_height; ++row) {
memcpy(dst, src, src_ybc->uv_width);
src += src_ybc->uv_stride;
dst += dst_ybc->uv_stride;
}
src = src_ybc->v_buffer;
dst = dst_ybc->v_buffer;
for (row = 0; row < src_ybc->uv_height; ++row) {
memcpy(dst, src, src_ybc->uv_width);
src += src_ybc->uv_stride;
dst += dst_ybc->uv_stride;
}
vp8_yv12_extend_frame_borders_c(dst_ybc);
}
#if CONFIG_VP9
void vpx_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc,
YV12_BUFFER_CONFIG *dst_ybc) {
int row;
const uint8_t *src = src_ybc->y_buffer;
uint8_t *dst = dst_ybc->y_buffer;
#if 0 #if 0
/* These assertions are valid in the codec, but the libvpx-tester uses /* These assertions are valid in the codec, but the libvpx-tester uses
* this code slightly differently. * this code slightly differently.
@ -249,7 +273,7 @@ void vp8_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc,
dst += dst_ybc->uv_stride; dst += dst_ybc->uv_stride;
} }
vp8_yv12_extend_frame_borders_c(dst_ybc); vpx_extend_frame_borders_c(dst_ybc);
return; return;
} else { } else {
assert(!(dst_ybc->flags & YV12_FLAG_HIGHBITDEPTH)); assert(!(dst_ybc->flags & YV12_FLAG_HIGHBITDEPTH));
@ -280,8 +304,9 @@ void vp8_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc,
dst += dst_ybc->uv_stride; dst += dst_ybc->uv_stride;
} }
vp8_yv12_extend_frame_borders_c(dst_ybc); vpx_extend_frame_borders_c(dst_ybc);
} }
#endif // CONFIG_VP9
void vpx_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc, void vpx_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc,
YV12_BUFFER_CONFIG *dst_ybc) { YV12_BUFFER_CONFIG *dst_ybc) {

View File

@ -23,6 +23,8 @@ add_proto qw/void vp8_yv12_copy_frame/, "const struct yv12_buffer_config *src_yb
add_proto qw/void vpx_yv12_copy_y/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc"; add_proto qw/void vpx_yv12_copy_y/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc";
if (vpx_config("CONFIG_VP9") eq "yes") { if (vpx_config("CONFIG_VP9") eq "yes") {
add_proto qw/void vpx_yv12_copy_frame/, "const struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc";
add_proto qw/void vpx_extend_frame_borders/, "struct yv12_buffer_config *ybf"; add_proto qw/void vpx_extend_frame_borders/, "struct yv12_buffer_config *ybf";
specialize qw/vpx_extend_frame_borders dspr2/; specialize qw/vpx_extend_frame_borders dspr2/;