Commit ee35f4de authored by Paul Wilkins's avatar Paul Wilkins

Fix some HBD scaling bugs.

Fixed a bug for HBD in stats output and scaling of a threshold
within the first pass code.

Change-Id: Icd0463d78cc9ce4661b027b0612c55c0628d212f
parent bfc2a7e3
......@@ -3090,7 +3090,27 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) {
#endif // CONFIG_VP9_HIGHBITDEPTH
if (cpi->twopass.total_left_stats.coded_error != 0.0)
if (cpi->twopass.total_left_stats.coded_error != 0.0) {
double dc_quant_devisor;
#if CONFIG_VP9_HIGHBITDEPTH
switch (cm->bit_depth) {
case VPX_BITS_8:
dc_quant_devisor = 4.0;
break;
case VPX_BITS_10:
dc_quant_devisor = 16.0;
break;
case VPX_BITS_12:
dc_quant_devisor = 64.0;
break;
default:
assert(0 && "bit_depth must be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12");
break;
}
#else
dc_quant_devisor = 4.0;
#endif
fprintf(f, "%10u %dx%d %10d %10d %d %d %10d %10d %10d %10d"
"%10"PRId64" %10"PRId64" %5d %5d %10"PRId64" "
"%10"PRId64" %10"PRId64" %10d "
......@@ -3116,7 +3136,8 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) {
(cpi->rc.starting_buffer_level - cpi->rc.bits_off_target),
cpi->rc.total_actual_bits, cm->base_qindex,
vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth),
(double)vp9_dc_quant(cm->base_qindex, 0, cm->bit_depth) / 4.0,
(double)vp9_dc_quant(cm->base_qindex, 0, cm->bit_depth) /
dc_quant_devisor,
vp9_convert_qindex_to_q(cpi->twopass.active_worst_quality,
cm->bit_depth),
cpi->rc.avg_q,
......@@ -3131,7 +3152,7 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) {
cpi->twopass.kf_zeromotion_pct,
cpi->twopass.fr_content_type,
cm->lf.filter_level);
}
fclose(f);
if (0) {
......
......@@ -490,7 +490,35 @@ static void set_first_pass_params(VP9_COMP *cpi) {
cpi->rc.frames_to_key = INT_MAX;
}
// This threshold is used to track blocks where to all intents and purposes
// the intra prediction error 0. Though the metric we test against
// is technically a sse we are mainly interested in blocks where all the pixels
// int he 8 bit domain have an error of <= 1 (where error = sse) so a
// linear scaling for 10 and 12 bit gives similar results.
#define UL_INTRA_THRESH 50
#if CONFIG_VP9_HIGHBITDEPTH
static int get_ul_intra_threshold(VP9_COMMON *cm) {
int ret_val = UL_INTRA_THRESH;
if (cm->use_highbitdepth) {
switch (cm->bit_depth) {
case VPX_BITS_8:
ret_val = UL_INTRA_THRESH;
break;
case VPX_BITS_10:
ret_val = UL_INTRA_THRESH >> 2;
break;
case VPX_BITS_12:
ret_val = UL_INTRA_THRESH >> 4;
break;
default:
assert(0 && "cm->bit_depth should be VPX_BITS_8, "
"VPX_BITS_10 or VPX_BITS_12");
}
}
return ret_val;
}
#endif // CONFIG_VP9_HIGHBITDEPTH
#define INVALID_ROW -1
void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
int mb_row, mb_col;
......@@ -681,7 +709,11 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
// domain). In natural videos this is uncommon, but it is much more
// common in animations, graphics and screen content, so may be used
// as a signal to detect these types of content.
#if CONFIG_VP9_HIGHBITDEPTH
if (this_error < get_ul_intra_threshold(cm)) {
#else
if (this_error < UL_INTRA_THRESH) {
#endif
++intra_skip_count;
} else if ((mb_col > 0) && (image_data_start_row == INVALID_ROW)) {
image_data_start_row = mb_row;
......
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