Merge "High-bitdepth bugfixes"
This commit is contained in:
@@ -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));
|
||||||
@@ -489,6 +489,7 @@ void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
|
|||||||
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,
|
||||||
int q) {
|
int q) {
|
||||||
|
|||||||
@@ -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) {
|
|||||||
- 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 {
|
|||||||
|
|
||||||
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,
|
|||||||
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,
|
|||||||
|
|
||||||
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,
|
|||||||
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,
|
|||||||
|
|
||||||
#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,
|
|||||||
#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,
|
|||||||
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);
|
||||||
|
|||||||
@@ -250,11 +250,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,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,22 +92,7 @@ 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) {
|
|
||||||
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) {
|
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;
|
||||||
@@ -167,38 +132,22 @@ 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 = high_ssim_8x8_shift(CONVERT_TO_SHORTPTR(img1 + j),
|
double v = highbd_ssim_8x8(CONVERT_TO_SHORTPTR(img1 + j), stride_img1,
|
||||||
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;
|
||||||
return ssim_total;
|
return ssim_total;
|
||||||
}
|
}
|
||||||
@@ -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,
|
|||||||
|
|
||||||
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,
|
|||||||
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,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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,
|
|||||||
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();
|
|||||||
|
|
||||||
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,
|
|||||||
#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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img,
|
|||||||
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 */
|
||||||
@@ -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,
|
|||||||
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))
|
||||||
|
|||||||
41
vpxenc.c
41
vpxenc.c
@@ -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) {
|
|||||||
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,
|
|||||||
int h = src->h;
|
int h = src->h;
|
||||||
int x, y;
|
int x, y;
|
||||||
if (plane) {
|
if (plane) {
|
||||||
w >>= src->x_chroma_shift;
|
w = (w + src->x_chroma_shift) >> src->x_chroma_shift;
|
||||||
h >>= src->y_chroma_shift;
|
h = (h + src->y_chroma_shift) >> src->y_chroma_shift;
|
||||||
}
|
}
|
||||||
for (y = 0; y < h; y++) {
|
for (y = 0; y < h; y++) {
|
||||||
uint8_t *p_src = src->planes[plane] + y * src->stride[plane];
|
uint8_t *p_src = src->planes[plane] + y * src->stride[plane];
|
||||||
@@ -2272,24 +2272,29 @@ int main(int argc, const char **argv_) {
|
|||||||
if (stream_cnt > 1)
|
if (stream_cnt > 1)
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (!global.quiet)
|
if (!global.quiet) {
|
||||||
FOREACH_STREAM(fprintf(
|
FOREACH_STREAM(fprintf(stderr,
|
||||||
stderr,
|
"\rPass %d/%d frame %4d/%-4d %7"PRId64"B %7"PRId64"b/f %7"PRId64"b/s"
|
||||||
"\rPass %d/%d frame %4d/%-4d %7"PRId64"B %7lub/f %7"PRId64"b/s"
|
" %7"PRId64" %s (%.2f fps)\033[K\n",
|
||||||
" %7"PRId64" %s (%.2f fps)\033[K\n", pass + 1,
|
pass + 1,
|
||||||
global.passes, frames_in, stream->frames_out, (int64_t)stream->nbytes,
|
global.passes, frames_in, stream->frames_out, (int64_t)stream->nbytes,
|
||||||
seen_frames ? (unsigned long)(stream->nbytes * 8 / seen_frames) : 0,
|
seen_frames ? (int64_t)(stream->nbytes * 8 / seen_frames) : 0,
|
||||||
seen_frames ? (int64_t)stream->nbytes * 8
|
seen_frames ? (int64_t)stream->nbytes * 8 *
|
||||||
* (int64_t)global.framerate.num / global.framerate.den
|
(int64_t)global.framerate.num / global.framerate.den /
|
||||||
/ seen_frames
|
seen_frames : 0,
|
||||||
: 0,
|
|
||||||
stream->cx_time > 9999999 ? stream->cx_time / 1000 : stream->cx_time,
|
stream->cx_time > 9999999 ? stream->cx_time / 1000 : stream->cx_time,
|
||||||
stream->cx_time > 9999999 ? "ms" : "us",
|
stream->cx_time > 9999999 ? "ms" : "us",
|
||||||
usec_to_fps(stream->cx_time, seen_frames));
|
usec_to_fps(stream->cx_time, seen_frames)));
|
||||||
);
|
}
|
||||||
|
|
||||||
if (global.show_psnr)
|
if (global.show_psnr) {
|
||||||
FOREACH_STREAM(show_psnr(stream));
|
if (global.codec->fourcc == VP9_FOURCC) {
|
||||||
|
FOREACH_STREAM(
|
||||||
|
show_psnr(stream, (1 << stream->config.cfg.g_input_bit_depth) - 1));
|
||||||
|
} else {
|
||||||
|
FOREACH_STREAM(show_psnr(stream, 255.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FOREACH_STREAM(vpx_codec_destroy(&stream->encoder));
|
FOREACH_STREAM(vpx_codec_destroy(&stream->encoder));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user