Commit 55118ad0 authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Merge branch 'master' into nextgenv2

Conflicts:
	vp10/decoder/decodeframe.c
	vp10/encoder/bitstream.c

Change-Id: I743449f49b723d2ce357832619a28b53369d0547
parents 3787b174 2bd4f444
......@@ -35,6 +35,9 @@ Advanced options:
${toggle_debug_libs} in/exclude debug version of libraries
${toggle_static_msvcrt} use static MSVCRT (VS builds only)
${toggle_vp9_highbitdepth} use VP9 high bit depth (10/12) profiles
${toggle_better_hw_compatibility}
enable encoder to produce streams with better
hardware decoder compatibility
${toggle_vp8} VP8 codec support
${toggle_vp9} VP9 codec support
${toggle_vp10} VP10 codec support
......@@ -330,6 +333,7 @@ CONFIG_LIST="
vp9_temporal_denoising
coefficient_range_checking
vp9_highbitdepth
better_hw_compatibility
experimental
size_limit
${EXPERIMENT_LIST}
......@@ -388,6 +392,7 @@ CMDLINE_SELECT="
temporal_denoising
vp9_temporal_denoising
coefficient_range_checking
better_hw_compatibility
vp9_highbitdepth
experimental
"
......
......@@ -2977,8 +2977,8 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
}
setup_segmentation_dequant(cm);
cm->tx_mode = (xd->lossless[0]) ? ONLY_4X4
: read_tx_mode(rb);
cm->tx_mode = (!cm->seg.enabled && xd->lossless[0]) ? ONLY_4X4
: read_tx_mode(rb);
cm->reference_mode = read_frame_reference_mode(cm, rb);
setup_tile_info(cm, rb);
......
......@@ -207,6 +207,8 @@ static TX_SIZE read_tx_size(VP10_COMMON *cm, MACROBLOCKD *xd,
TX_MODE tx_mode = cm->tx_mode;
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
if (xd->lossless[xd->mi[0]->mbmi.segment_id])
return TX_4X4;
if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8)
return read_selected_tx_size(cm, xd, max_tx_size, r);
else
......
......@@ -715,7 +715,7 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
#if CONFIG_SUPERTX
!supertx_enabled &&
#endif // CONFIG_SUPERTX
!(is_inter && skip)) {
!(is_inter && skip) && !xd->lossless[segment_id]) {
#if CONFIG_VAR_TX
if (is_inter) { // This implies skip flag is 0.
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
......@@ -889,7 +889,8 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
write_skip(cm, xd, mbmi->segment_id, mi, w);
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT)
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
!xd->lossless[mbmi->segment_id])
write_selected_tx_size(cm, xd, w);
if (bsize >= BLOCK_8X8) {
......@@ -1900,7 +1901,7 @@ static void write_uncompressed_header(VP10_COMP *cpi,
encode_loopfilter(&cm->lf, wb);
encode_quantization(cm, wb);
encode_segmentation(cm, xd, wb);
if (xd->lossless[0])
if (!cm->seg.enabled && xd->lossless[0])
cm->tx_mode = TX_4X4;
else
write_txfm_mode(cm->tx_mode, wb);
......
......@@ -190,6 +190,12 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
// Co-ordinate of containing block to pixel precision.
const int x_start = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x));
const int y_start = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y));
#if CONFIG_BETTER_HW_COMPATIBILITY
assert(xd->mi[0]->mbmi.sb_type != BLOCK_4X8 &&
xd->mi[0]->mbmi.sb_type != BLOCK_8X4);
assert(mv_q4.row == mv.row * (1 << (1 - pd->subsampling_y)) &&
mv_q4.col == mv.col * (1 << (1 - pd->subsampling_x)));
#endif
if (plane == 0)
pre_buf->buf = xd->block_refs[ref]->buf->y_buffer;
else if (plane == 1)
......
......@@ -587,7 +587,12 @@ static void dec_build_inter_predictors(VP9Decoder *const pbi, MACROBLOCKD *xd,
// Co-ordinate of containing block to pixel precision.
int x_start = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x));
int y_start = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y));
#if CONFIG_BETTER_HW_COMPATIBILITY
assert(xd->mi[0]->mbmi.sb_type != BLOCK_4X8 &&
xd->mi[0]->mbmi.sb_type != BLOCK_8X4);
assert(mv_q4.row == mv->row * (1 << (1 - pd->subsampling_y)) &&
mv_q4.col == mv->col * (1 << (1 - pd->subsampling_x)));
#endif
// Co-ordinate of the block to 1/16th pixel precision.
x0_16 = (x_start + x) << SUBPEL_BITS;
y0_16 = (y_start + y) << SUBPEL_BITS;
......
......@@ -208,20 +208,12 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi,
if (refresh_this_block == 0 &&
bsize <= BLOCK_16X16 &&
cpi->oxcf.content != VP9E_CONTENT_SCREEN) {
// Take center pixel in block to determine is_skin.
const int y_width_shift = (4 << b_width_log2_lookup[bsize]) >> 1;
const int y_height_shift = (4 << b_height_log2_lookup[bsize]) >> 1;
const int uv_width_shift = y_width_shift >> 1;
const int uv_height_shift = y_height_shift >> 1;
const int stride = p[0].src.stride;
const int strideuv = p[1].src.stride;
const uint8_t ysource =
p[0].src.buf[y_height_shift * stride + y_width_shift];
const uint8_t usource =
p[1].src.buf[uv_height_shift * strideuv + uv_width_shift];
const uint8_t vsource =
p[2].src.buf[uv_height_shift * strideuv + uv_width_shift];
is_skin = vp9_skin_pixel(ysource, usource, vsource);
is_skin = vp9_compute_skin_block(p[0].src.buf,
p[1].src.buf,
p[2].src.buf,
p[0].src.stride,
p[1].src.stride,
bsize);
if (is_skin)
refresh_this_block = 1;
}
......
......@@ -333,20 +333,12 @@ void vp9_denoiser_denoise(VP9_DENOISER *denoiser, MACROBLOCK *mb,
int is_skin = 0;
if (bs <= BLOCK_16X16 && denoiser->denoising_level >= kDenLow) {
// Take center pixel in block to determine is_skin.
const int y_width_shift = (4 << b_width_log2_lookup[bs]) >> 1;
const int y_height_shift = (4 << b_height_log2_lookup[bs]) >> 1;
const int uv_width_shift = y_width_shift >> 1;
const int uv_height_shift = y_height_shift >> 1;
const int stride = mb->plane[0].src.stride;
const int strideuv = mb->plane[1].src.stride;
const uint8_t ysource =
mb->plane[0].src.buf[y_height_shift * stride + y_width_shift];
const uint8_t usource =
mb->plane[1].src.buf[uv_height_shift * strideuv + uv_width_shift];
const uint8_t vsource =
mb->plane[2].src.buf[uv_height_shift * strideuv + uv_width_shift];
is_skin = vp9_skin_pixel(ysource, usource, vsource);
is_skin = vp9_compute_skin_block(mb->plane[0].src.buf,
mb->plane[1].src.buf,
mb->plane[2].src.buf,
mb->plane[0].src.stride,
mb->plane[1].src.stride,
bs);
}
mv_col = ctx->best_sse_mv.as_mv.col;
......
......@@ -145,10 +145,6 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
const uint8_t *src_u = cpi->Source->u_buffer;
const uint8_t *src_v = cpi->Source->v_buffer;
const int src_uvstride = cpi->Source->uv_stride;
const int y_width_shift = (4 << b_width_log2_lookup[bsize]) >> 1;
const int y_height_shift = (4 << b_height_log2_lookup[bsize]) >> 1;
const int uv_width_shift = y_width_shift >> 1;
const int uv_height_shift = y_height_shift >> 1;
int mi_row, mi_col;
int num_low_motion = 0;
int frame_low_motion = 1;
......@@ -173,13 +169,12 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
// been encoded as zero/low motion x (= thresh_consec_zeromv) frames
// in a row. consec_zero_mv[] defined for 8x8 blocks, so consider all
// 4 sub-blocks for 16x16 block. Also, avoid skin blocks.
const uint8_t ysource =
src_y[y_height_shift * src_ystride + y_width_shift];
const uint8_t usource =
src_u[uv_height_shift * src_uvstride + uv_width_shift];
const uint8_t vsource =
src_v[uv_height_shift * src_uvstride + uv_width_shift];
int is_skin = vp9_skin_pixel(ysource, usource, vsource);
int is_skin = vp9_compute_skin_block(src_y,
src_u,
src_v,
src_ystride,
src_uvstride,
bsize);
if (frame_low_motion &&
cr->consec_zero_mv[bl_index] > thresh_consec_zeromv &&
cr->consec_zero_mv[bl_index1] > thresh_consec_zeromv &&
......
......@@ -48,6 +48,20 @@ int vp9_skin_pixel(const uint8_t y, const uint8_t cb, const uint8_t cr) {
return (evaluate_skin_color_difference(cb, cr) < skin_threshold);
}
int vp9_compute_skin_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
int stride, int strideuv, int bsize) {
// Take center pixel in block to determine is_skin.
const int y_width_shift = (4 << b_width_log2_lookup[bsize]) >> 1;
const int y_height_shift = (4 << b_height_log2_lookup[bsize]) >> 1;
const int uv_width_shift = y_width_shift >> 1;
const int uv_height_shift = y_height_shift >> 1;
const uint8_t ysource = y[y_height_shift * stride + y_width_shift];
const uint8_t usource = u[uv_height_shift * strideuv + uv_width_shift];
const uint8_t vsource = v[uv_height_shift * strideuv + uv_width_shift];
return vp9_skin_pixel(ysource, usource, vsource);
}
#ifdef OUTPUT_YUV_SKINMAP
// For viewing skin map on input source.
void vp9_compute_skin_map(VP9_COMP *const cpi, FILE *yuv_skinmap_file) {
......
......@@ -23,6 +23,9 @@ struct VP9_COMP;
int vp9_skin_pixel(const uint8_t y, const uint8_t cb, const uint8_t cr);
int vp9_compute_skin_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
int stride, int strideuv, int bsize);
#ifdef OUTPUT_YUV_SKINMAP
// For viewing skin map on input source.
void vp9_compute_skin_map(struct VP9_COMP *const cpi, FILE *yuv_skinmap_file);
......
......@@ -36,6 +36,12 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
svc->current_superframe = 0;
for (i = 0; i < REF_FRAMES; ++i)
svc->ref_frame_index[i] = -1;
for (sl = 0; sl < oxcf->ss_number_layers; ++sl) {
cpi->svc.ext_frame_flags[sl] = 0;
cpi->svc.ext_lst_fb_idx[sl] = 0;
cpi->svc.ext_gld_fb_idx[sl] = 1;
cpi->svc.ext_alt_fb_idx[sl] = 2;
}
if (cpi->oxcf.error_resilient_mode == 0 && cpi->oxcf.pass == 2) {
if (vpx_realloc_frame_buffer(&cpi->svc.empty_frame.img,
......@@ -566,6 +572,8 @@ int vp9_one_pass_cbr_svc_start_layer(VP9_COMP *const cpi) {
// Note that the check (cpi->ext_refresh_frame_flags_pending == 0) is
// needed to support the case where the frame flags may be passed in via
// vpx_codec_encode(), which can be used for the temporal-only svc case.
// TODO(marpan): Consider adding an enc_config parameter to better handle
// this case.
if (cpi->ext_refresh_frame_flags_pending == 0) {
int sl;
cpi->svc.spatial_layer_id = cpi->svc.spatial_layer_to_encode;
......
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