Commit a160d725 authored by Deb Mukherjee's avatar Deb Mukherjee

High-bitdepth bugfixes

Miscellaneous bug-fixes for high bitdepth functionality.
With this patch, high bit-depth profiles become mostly functional,
except for an intermittent assert failure issue that is being
tracked.

Change-Id: I6a7fcbdcf1e5b09842e88535f8442d2e1230748c
parent 10c7876a
...@@ -469,7 +469,7 @@ void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, ...@@ -469,7 +469,7 @@ void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer}; uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride}; const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
for (i = 0; i < MAX_MB_PLANE; ++i) for (i = 0; i < MAX_MB_PLANE; ++i) {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
assert((src->flags & YV12_FLAG_HIGHBITDEPTH) == assert((src->flags & YV12_FLAG_HIGHBITDEPTH) ==
(dst->flags & YV12_FLAG_HIGHBITDEPTH)); (dst->flags & YV12_FLAG_HIGHBITDEPTH));
...@@ -488,6 +488,7 @@ void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, ...@@ -488,6 +488,7 @@ void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
src_strides[i], dst_strides[i], src_strides[i], dst_strides[i],
src_heights[i], src_widths[i], ppl); src_heights[i], src_widths[i], ppl);
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
}
} }
void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
......
...@@ -1802,11 +1802,8 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") { ...@@ -1802,11 +1802,8 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
# Structured Similarity (SSIM) # Structured Similarity (SSIM)
# #
if (vpx_config("CONFIG_INTERNAL_STATS") eq "yes") { if (vpx_config("CONFIG_INTERNAL_STATS") eq "yes") {
add_proto qw/void vp9_high_ssim_parms_8x8/, "uint16_t *s, int sp, uint16_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr"; add_proto qw/void vp9_highbd_ssim_parms_8x8/, "uint16_t *s, int sp, uint16_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr";
specialize qw/vp9_high_ssim_parms_8x8/; specialize qw/vp9_highbd_ssim_parms_8x8/;
add_proto qw/void vp9_high_ssim_parms_8x8_shift/, "uint16_t *s, int sp, uint16_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr, unsigned int bd, unsigned int shift";
specialize qw/vp9_high_ssim_parms_8x8_shift/;
} }
# fdct functions # fdct functions
......
...@@ -1712,15 +1712,16 @@ void vp9_remove_compressor(VP9_COMP *cpi) { ...@@ -1712,15 +1712,16 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
- cpi->first_time_stamp_ever) / 10000000.000; - cpi->first_time_stamp_ever) / 10000000.000;
double total_encode_time = (cpi->time_receive_data + double total_encode_time = (cpi->time_receive_data +
cpi->time_compress_data) / 1000.000; cpi->time_compress_data) / 1000.000;
double dr = (double)cpi->bytes * (double) 8 / (double)1000 const double dr =
/ time_encoded; (double)cpi->bytes * (double) 8 / (double)1000 / time_encoded;
const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1);
if (cpi->b_calculate_psnr) { if (cpi->b_calculate_psnr) {
const double total_psnr = const double total_psnr =
vpx_sse_to_psnr((double)cpi->total_samples, 255.0, vpx_sse_to_psnr((double)cpi->total_samples, peak,
(double)cpi->total_sq_error); (double)cpi->total_sq_error);
const double totalp_psnr = const double totalp_psnr =
vpx_sse_to_psnr((double)cpi->totalp_samples, 255.0, vpx_sse_to_psnr((double)cpi->totalp_samples, peak,
(double)cpi->totalp_sq_error); (double)cpi->totalp_sq_error);
const double total_ssim = 100 * pow(cpi->summed_quality / const double total_ssim = 100 * pow(cpi->summed_quality /
cpi->summed_weights, 8.0); cpi->summed_weights, 8.0);
...@@ -1914,6 +1915,7 @@ typedef struct { ...@@ -1914,6 +1915,7 @@ typedef struct {
static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b, static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
PSNR_STATS *psnr) { PSNR_STATS *psnr) {
static const double peak = 255.0;
const int widths[3] = {a->y_width, a->uv_width, a->uv_width }; const int widths[3] = {a->y_width, a->uv_width, a->uv_width };
const int heights[3] = {a->y_height, a->uv_height, a->uv_height}; const int heights[3] = {a->y_height, a->uv_height, a->uv_height};
const uint8_t *a_planes[3] = {a->y_buffer, a->u_buffer, a->v_buffer }; const uint8_t *a_planes[3] = {a->y_buffer, a->u_buffer, a->v_buffer };
...@@ -1933,7 +1935,7 @@ static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b, ...@@ -1933,7 +1935,7 @@ static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
w, h); w, h);
psnr->sse[1 + i] = sse; psnr->sse[1 + i] = sse;
psnr->samples[1 + i] = samples; psnr->samples[1 + i] = samples;
psnr->psnr[1 + i] = vpx_sse_to_psnr(samples, 255.0, (double)sse); psnr->psnr[1 + i] = vpx_sse_to_psnr(samples, peak, (double)sse);
total_sse += sse; total_sse += sse;
total_samples += samples; total_samples += samples;
...@@ -1941,7 +1943,7 @@ static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b, ...@@ -1941,7 +1943,7 @@ static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
psnr->sse[0] = total_sse; psnr->sse[0] = total_sse;
psnr->samples[0] = total_samples; psnr->samples[0] = total_samples;
psnr->psnr[0] = vpx_sse_to_psnr((double)total_samples, 255.0, psnr->psnr[0] = vpx_sse_to_psnr((double)total_samples, peak,
(double)total_sse); (double)total_sse);
} }
...@@ -3699,7 +3701,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, ...@@ -3699,7 +3701,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
vp9_clear_system_state(); vp9_clear_system_state();
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
calc_highbd_psnr(orig, recon, &psnr, cpi->mb.e_mbd.bd, calc_highbd_psnr(orig, pp, &psnr, cpi->mb.e_mbd.bd,
cpi->oxcf.input_bit_depth); cpi->oxcf.input_bit_depth);
#else #else
calc_psnr(orig, pp, &psnr2); calc_psnr(orig, pp, &psnr2);
...@@ -3714,11 +3716,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, ...@@ -3714,11 +3716,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (cm->use_highbitdepth) { if (cm->use_highbitdepth) {
frame_ssim2 = vp9_highbd_calc_ssim( frame_ssim2 = vp9_highbd_calc_ssim(orig, recon, &weight, xd->bd);
orig, recon, &weight, xd->bd,
xd->bd - cpi->oxcf.input_bit_depth);
} else { } else {
frame_ssim2 = vp9_calc_ssim(orig, recon, 1, &weight); frame_ssim2 = vp9_calc_ssim(orig, recon, &weight);
} }
#else #else
frame_ssim2 = vp9_calc_ssim(orig, recon, &weight); frame_ssim2 = vp9_calc_ssim(orig, recon, &weight);
...@@ -3730,8 +3730,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, ...@@ -3730,8 +3730,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (cm->use_highbitdepth) { if (cm->use_highbitdepth) {
frame_ssim2 = vp9_highbd_calc_ssim( frame_ssim2 = vp9_highbd_calc_ssim(
orig, &cm->post_proc_buffer, &weight, orig, &cm->post_proc_buffer, &weight, xd->bd);
xd->bd, xd->bd - cpi->oxcf.input_bit_depth);
} else { } else {
frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, &weight); frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, &weight);
} }
...@@ -3757,10 +3756,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, ...@@ -3757,10 +3756,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
if (cpi->b_calculate_ssimg) { if (cpi->b_calculate_ssimg) {
double y, u, v, frame_all; double y, u, v, frame_all;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (cm->use_high) { if (cm->use_highbitdepth) {
frame_all = vp9_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y, frame_all = vp9_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y,
&u, &v, xd->bd, &u, &v, xd->bd);
xd->bd - cpi->oxcf.input_bit_depth);
} else { } else {
frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u,
&v); &v);
......
...@@ -246,11 +246,11 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize, ...@@ -246,11 +246,11 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
} else { } else {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vp9_model_rd_from_var_lapndz(sse, 1 << num_pels_log2_lookup[bs], vp9_model_rd_from_var_lapndz(sum_sse, 1 << num_pels_log2_lookup[bs],
pd->dequant[1] >> (xd->bd - 5), pd->dequant[1] >> (xd->bd - 5),
&rate, &dist); &rate, &dist);
} else { } else {
vp9_model_rd_from_var_lapndz(sse, 1 << num_pels_log2_lookup[bs], vp9_model_rd_from_var_lapndz(sum_sse, 1 << num_pels_log2_lookup[bs],
pd->dequant[1] >> 3, &rate, &dist); pd->dequant[1] >> 3, &rate, &dist);
} }
#else #else
......
...@@ -59,26 +59,6 @@ void vp9_highbd_ssim_parms_8x8_c(uint16_t *s, int sp, uint16_t *r, int rp, ...@@ -59,26 +59,6 @@ void vp9_highbd_ssim_parms_8x8_c(uint16_t *s, int sp, uint16_t *r, int rp,
} }
} }
} }
void vp9_highbd_ssim_parms_8x8_shift_c(uint16_t *s, int sp, uint16_t *r, int rp,
uint32_t *sum_s, uint32_t *sum_r,
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
uint32_t *sum_sxr, unsigned int bd,
unsigned int shift) {
int i, j;
const int max_val = (1 << bd) - 1;
for (i = 0; i < 8; i++, s += sp, r += rp) {
for (j = 0; j < 8; j++) {
int sj = s[j];
int rj = r[j];
*sum_s += sj;
*sum_r += rj;
*sum_sq_s += sj * sj;
*sum_sq_r += rj * rj;
*sum_sxr += sj * rj;
}
}
}
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
static const int64_t cc1 = 26634; // (64^2*(.01*255)^2 static const int64_t cc1 = 26634; // (64^2*(.01*255)^2
...@@ -112,23 +92,8 @@ static double ssim_8x8(uint8_t *s, int sp, uint8_t *r, int rp) { ...@@ -112,23 +92,8 @@ static double ssim_8x8(uint8_t *s, int sp, uint8_t *r, int rp) {
} }
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
static double high_ssim_8x8_shift(uint16_t *s, int sp, uint16_t *r, int rp, static double highbd_ssim_8x8(uint16_t *s, int sp, uint16_t *r, int rp,
unsigned int bd, unsigned int shift) { unsigned int bd) {
uint32_t sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
const int oshift = bd - 8;
vp9_highbd_ssim_parms_8x8_shift(s, sp, r, rp, &sum_s,
&sum_r, &sum_sq_s, &sum_sq_r,
&sum_sxr, bd, shift);
return similarity(sum_s >> oshift,
sum_r >> oshift,
sum_sq_s >> (2 * oshift),
sum_sq_r >> (2 * oshift),
sum_sxr >> (2 * oshift),
64);
}
static double high_ssim_8x8(uint16_t *s, int sp, uint16_t *r, int rp,
unsigned int bd) {
uint32_t sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0; uint32_t sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
const int oshift = bd - 8; const int oshift = bd - 8;
vp9_highbd_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r, vp9_highbd_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r,
...@@ -167,36 +132,20 @@ double vp9_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1, ...@@ -167,36 +132,20 @@ double vp9_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
double vp9_highbd_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1, double vp9_highbd_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
int stride_img2, int width, int height, int stride_img2, int width, int height,
unsigned int bd, unsigned int shift) { unsigned int bd) {
int i, j; int i, j;
int samples = 0; int samples = 0;
double ssim_total = 0; double ssim_total = 0;
if (shift) { // sample point start with each 4x4 location
// sample point start with each 4x4 location for (i = 0; i <= height - 8;
for (i = 0; i <= height - 8; i += 4, img1 += stride_img1 * 4, img2 += stride_img2 * 4) {
i += 4, img1 += stride_img1 * 4, img2 += stride_img2 * 4) { for (j = 0; j <= width - 8; j += 4) {
for (j = 0; j <= width - 8; j += 4) { double v = highbd_ssim_8x8(CONVERT_TO_SHORTPTR(img1 + j), stride_img1,
double v = high_ssim_8x8_shift(CONVERT_TO_SHORTPTR(img1 + j),
stride_img1,
CONVERT_TO_SHORTPTR(img2 + j),
stride_img2,
bd, shift);
ssim_total += v;
samples++;
}
}
} else {
// sample point start with each 4x4 location
for (i = 0; i <= height - 8;
i += 4, img1 += stride_img1 * 4, img2 += stride_img2 * 4) {
for (j = 0; j <= width - 8; j += 4) {
double v = high_ssim_8x8(CONVERT_TO_SHORTPTR(img1 + j), stride_img1,
CONVERT_TO_SHORTPTR(img2 + j), stride_img2, CONVERT_TO_SHORTPTR(img2 + j), stride_img2,
bd); bd);
ssim_total += v; ssim_total += v;
samples++; samples++;
}
} }
} }
ssim_total /= samples; ssim_total /= samples;
...@@ -255,25 +204,21 @@ double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, ...@@ -255,25 +204,21 @@ double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source, double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source,
YV12_BUFFER_CONFIG *dest, YV12_BUFFER_CONFIG *dest,
double *weight, unsigned int bd, double *weight, unsigned int bd) {
unsigned int shift) {
double a, b, c; double a, b, c;
double ssimv; double ssimv;
a = vp9_highbd_ssim2(source->y_buffer, dest->y_buffer, a = vp9_highbd_ssim2(source->y_buffer, dest->y_buffer,
source->y_stride, dest->y_stride, source->y_stride, dest->y_stride,
source->y_crop_width, source->y_crop_height, source->y_crop_width, source->y_crop_height, bd);
bd, shift);
b = vp9_highbd_ssim2(source->u_buffer, dest->u_buffer, b = vp9_highbd_ssim2(source->u_buffer, dest->u_buffer,
source->uv_stride, dest->uv_stride, source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height, source->uv_crop_width, source->uv_crop_height, bd);
bd, shift);
c = vp9_highbd_ssim2(source->v_buffer, dest->v_buffer, c = vp9_highbd_ssim2(source->v_buffer, dest->v_buffer,
source->uv_stride, dest->uv_stride, source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height, source->uv_crop_width, source->uv_crop_height, bd);
bd, shift);
ssimv = a * .8 + .1 * (b + c); ssimv = a * .8 + .1 * (b + c);
...@@ -284,25 +229,21 @@ double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source, ...@@ -284,25 +229,21 @@ double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source,
double vp9_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source, double vp9_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source,
YV12_BUFFER_CONFIG *dest, double *ssim_y, YV12_BUFFER_CONFIG *dest, double *ssim_y,
double *ssim_u, double *ssim_v, double *ssim_u, double *ssim_v, unsigned int bd) {
unsigned int bd, unsigned int shift) {
double ssim_all = 0; double ssim_all = 0;
double a, b, c; double a, b, c;
a = vp9_highbd_ssim2(source->y_buffer, dest->y_buffer, a = vp9_highbd_ssim2(source->y_buffer, dest->y_buffer,
source->y_stride, dest->y_stride, source->y_stride, dest->y_stride,
source->y_crop_width, source->y_crop_height, source->y_crop_width, source->y_crop_height, bd);
bd, shift);
b = vp9_highbd_ssim2(source->u_buffer, dest->u_buffer, b = vp9_highbd_ssim2(source->u_buffer, dest->u_buffer,
source->uv_stride, dest->uv_stride, source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height, source->uv_crop_width, source->uv_crop_height, bd);
bd, shift);
c = vp9_highbd_ssim2(source->v_buffer, dest->v_buffer, c = vp9_highbd_ssim2(source->v_buffer, dest->v_buffer,
source->uv_stride, dest->uv_stride, source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height, source->uv_crop_width, source->uv_crop_height, bd);
bd, shift);
*ssim_y = a; *ssim_y = a;
*ssim_u = b; *ssim_u = b;
*ssim_v = c; *ssim_v = c;
......
...@@ -27,16 +27,14 @@ double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, ...@@ -27,16 +27,14 @@ double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source, double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source,
YV12_BUFFER_CONFIG *dest, YV12_BUFFER_CONFIG *dest,
double *weight, double *weight,
unsigned int bd, unsigned int bd);
unsigned int shift);
double vp9_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source, double vp9_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source,
YV12_BUFFER_CONFIG *dest, YV12_BUFFER_CONFIG *dest,
double *ssim_y, double *ssim_y,
double *ssim_u, double *ssim_u,
double *ssim_v, double *ssim_v,
unsigned int bps, unsigned int bd);
unsigned int shift);
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -261,7 +261,7 @@ static void set_entropy_context_b(int plane, int block, BLOCK_SIZE plane_bsize, ...@@ -261,7 +261,7 @@ static void set_entropy_context_b(int plane, int block, BLOCK_SIZE plane_bsize,
} }
static INLINE void add_token(TOKENEXTRA **t, const vp9_prob *context_tree, static INLINE void add_token(TOKENEXTRA **t, const vp9_prob *context_tree,
int16_t extra, uint8_t token, int32_t extra, uint8_t token,
uint8_t skip_eob_node, uint8_t skip_eob_node,
unsigned int *counts) { unsigned int *counts) {
(*t)->token = token; (*t)->token = token;
...@@ -329,7 +329,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, ...@@ -329,7 +329,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
scan = so->scan; scan = so->scan;
nb = so->neighbors; nb = so->neighbors;
c = 0; c = 0;
#if CONFIG_VP9_HIGH && CONFIG_HIGH_QUANT #if CONFIG_VP9_HIGHBITDEPTH
if (cpi->common.profile >= PROFILE_2) { if (cpi->common.profile >= PROFILE_2) {
dct_value_tokens = (cpi->common.bit_depth == VPX_BITS_10 ? dct_value_tokens = (cpi->common.bit_depth == VPX_BITS_10 ?
vp9_dct_value_tokens_high10_ptr : vp9_dct_value_tokens_high10_ptr :
......
...@@ -26,12 +26,20 @@ void vp9_tokenize_initialize(); ...@@ -26,12 +26,20 @@ void vp9_tokenize_initialize();
typedef struct { typedef struct {
int16_t token; int16_t token;
#if CONFIG_VP9_HIGHBITDEPTH
int32_t extra;
#else
int16_t extra; int16_t extra;
#endif
} TOKENVALUE; } TOKENVALUE;
typedef struct { typedef struct {
const vp9_prob *context_tree; const vp9_prob *context_tree;
#if CONFIG_VP9_HIGHBITDEPTH
int32_t extra;
#else
int16_t extra; int16_t extra;
#endif
uint8_t token; uint8_t token;
uint8_t skip_eob_node; uint8_t skip_eob_node;
} TOKENEXTRA; } TOKENEXTRA;
......
...@@ -113,8 +113,6 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img, ...@@ -113,8 +113,6 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
#else #else
yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2; yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
return VPX_CODEC_OK; return VPX_CODEC_OK;
} }
......
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
#include "vpx/vpx_integer.h" #include "vpx/vpx_integer.h"
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
static vpx_image_t *img_alloc_helper(vpx_image_t *img, static vpx_image_t *img_alloc_helper(vpx_image_t *img,
vpx_img_fmt_t fmt, vpx_img_fmt_t fmt,
unsigned int d_w, unsigned int d_w,
unsigned int d_h, unsigned int d_h,
unsigned int buf_align, unsigned int buf_align,
unsigned int stride_align, unsigned int stride_align,
unsigned char *img_data) { unsigned char *img_data) {
unsigned int h, w, s, xcs, ycs, bps;
unsigned int h, w, s, xcs, ycs, bps; unsigned int stride_in_bytes;
int align; int align;
/* Treat align==0 like align==1 */ /* Treat align==0 like align==1 */
if (!buf_align) if (!buf_align)
...@@ -125,6 +125,7 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, ...@@ -125,6 +125,7 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img,
h = (d_h + align) & ~align; h = (d_h + align) & ~align;
s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8; s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;
s = (s + stride_align - 1) & ~(stride_align - 1); s = (s + stride_align - 1) & ~(stride_align - 1);
stride_in_bytes = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s;
/* Allocate the new image */ /* Allocate the new image */
if (!img) { if (!img) {
...@@ -163,8 +164,8 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, ...@@ -163,8 +164,8 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img,
img->bps = bps; img->bps = bps;
/* Calculate strides */ /* Calculate strides */
img->stride[VPX_PLANE_Y] = img->stride[VPX_PLANE_ALPHA] = s; img->stride[VPX_PLANE_Y] = img->stride[VPX_PLANE_ALPHA] = stride_in_bytes;
img->stride[VPX_PLANE_U] = img->stride[VPX_PLANE_V] = s >> xcs; img->stride[VPX_PLANE_U] = img->stride[VPX_PLANE_V] = stride_in_bytes >> xcs;
/* Default viewport to entire image */ /* Default viewport to entire image */
if (!vpx_img_set_rect(img, 0, 0, d_w, d_h)) if (!vpx_img_set_rect(img, 0, 0, d_w, d_h))
......
...@@ -1695,7 +1695,7 @@ static void get_cx_data(struct stream_state *stream, ...@@ -1695,7 +1695,7 @@ static void get_cx_data(struct stream_state *stream,
} }
static void show_psnr(struct stream_state *stream) { static void show_psnr(struct stream_state *stream, double peak) {
int i; int i;
double ovpsnr; double ovpsnr;
...@@ -1703,7 +1703,7 @@ static void show_psnr(struct stream_state *stream) { ...@@ -1703,7 +1703,7 @@ static void show_psnr(struct stream_state *stream) {
return; return;
fprintf(stderr, "Stream %d PSNR (Overall/Avg/Y/U/V)", stream->index); fprintf(stderr, "Stream %d PSNR (Overall/Avg/Y/U/V)", stream->index);
ovpsnr = sse_to_psnr((double)stream->psnr_samples_total, 255.0, ovpsnr = sse_to_psnr((double)stream->psnr_samples_total, peak,
(double)stream->psnr_sse_total); (double)stream->psnr_sse_total);
fprintf(stderr, " %.3f", ovpsnr); fprintf(stderr, " %.3f", ovpsnr);
...@@ -1784,8 +1784,8 @@ static void low_img_upshift(vpx_image_t *dst, vpx_image_t *src, ...@@ -1784,8 +1784,8 @@ static void low_img_upshift(vpx_image_t *dst, vpx_image_t *src,
int h = src->h; int h = src->h;
int x, y; int x, y;
if (plane) { if (plane) {
w >>= src->x_chroma_shift