diff options
Diffstat (limited to 'vp9/encoder/vp9_encoder.c')
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 8aee22756..370a581fd 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -18,7 +18,11 @@ #include "./vpx_scale_rtcd.h" #include "vpx/internal/vpx_psnr.h" #include "vpx_dsp/vpx_filter.h" +#if CONFIG_INTERNAL_STATS +#include "vpx_dsp/ssim.h" +#endif #include "vpx_ports/mem.h" +#include "vpx_ports/system_state.h" #include "vpx_ports/vpx_timer.h" #include "vpx_scale/vpx_scale.h" @@ -30,7 +34,6 @@ #endif #include "vp9/common/vp9_reconinter.h" #include "vp9/common/vp9_reconintra.h" -#include "vp9/common/vp9_systemdependent.h" #include "vp9/common/vp9_tile_common.h" #include "vp9/encoder/vp9_aq_complexity.h" @@ -51,9 +54,6 @@ #include "vp9/encoder/vp9_segmentation.h" #include "vp9/encoder/vp9_skin_detection.h" #include "vp9/encoder/vp9_speed_features.h" -#if CONFIG_INTERNAL_STATS -#include "vp9/encoder/vp9_ssim.h" -#endif #include "vp9/encoder/vp9_svc_layercontext.h" #include "vp9/encoder/vp9_temporal_filter.h" @@ -1709,7 +1709,8 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, } if (cpi->b_calculate_consistency) { - cpi->ssim_vars = vpx_malloc(sizeof(*cpi->ssim_vars)*720*480); + cpi->ssim_vars = vpx_malloc(sizeof(*cpi->ssim_vars) * + 4 * cpi->common.mi_rows * cpi->common.mi_cols); cpi->worst_consistency = 100.0; } @@ -1925,7 +1926,7 @@ void vp9_remove_compressor(VP9_COMP *cpi) { if (cpi && (cm->current_video_frame > 0)) { #if CONFIG_INTERNAL_STATS - vp9_clear_system_state(); + vpx_clear_system_state(); if (cpi->oxcf.pass != 1) { char headings[512] = {0}; @@ -2747,7 +2748,7 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) { } else { struct vpx_usec_timer timer; - vp9_clear_system_state(); + vpx_clear_system_state(); vpx_usec_timer_start(&timer); @@ -2931,7 +2932,7 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) { FILE *const f = fopen("tmp.stt", cm->current_video_frame ? "a" : "w"); int64_t recon_err; - vp9_clear_system_state(); + vpx_clear_system_state(); recon_err = vp9_get_y_sse(cpi->Source, get_frame_new_buffer(cm)); @@ -3183,7 +3184,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi) { VP9_COMMON *const cm = &cpi->common; int q = 0, bottom_index = 0, top_index = 0; // Dummy variables. - vp9_clear_system_state(); + vpx_clear_system_state(); set_frame_size(cpi); @@ -3247,7 +3248,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi) { // Update the skip mb flag probabilities based on the distribution // seen in the last encoder iteration. // update_base_skip_probs(cpi); - vp9_clear_system_state(); + vpx_clear_system_state(); } static void encode_with_recode_loop(VP9_COMP *cpi, @@ -3268,7 +3269,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi, set_size_independent_vars(cpi); do { - vp9_clear_system_state(); + vpx_clear_system_state(); set_frame_size(cpi); @@ -3332,7 +3333,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi, // seen in the last encoder iteration. // update_base_skip_probs(cpi); - vp9_clear_system_state(); + vpx_clear_system_state(); // Dummy pack of the bitstream using up to date stats to get an // accurate estimate of output frame size to determine if we need @@ -3636,7 +3637,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, TX_SIZE t; set_ext_overrides(cpi); - vp9_clear_system_state(); + vpx_clear_system_state(); // Set the arf sign bias for this frame. set_arf_sign_bias(cpi); @@ -3727,7 +3728,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, } } - vp9_clear_system_state(); + vpx_clear_system_state(); #if CONFIG_INTERNAL_STATS memset(cpi->mode_chosen_counts, 0, @@ -4247,7 +4248,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, } // Clear down mmx registers - vp9_clear_system_state(); + vpx_clear_system_state(); // adjust frame rates based on timestamps given if (cm->show_frame) { @@ -4399,7 +4400,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer, cm->lf.filter_level * 10 / 6); #endif - vp9_clear_system_state(); + vpx_clear_system_state(); #if CONFIG_VP9_HIGHBITDEPTH calc_highbd_psnr(orig, pp, &psnr2, cpi->td.mb.e_mbd.bd, @@ -4415,13 +4416,13 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, #if CONFIG_VP9_HIGHBITDEPTH if (cm->use_highbitdepth) { - frame_ssim2 = vp9_highbd_calc_ssim(orig, recon, &weight, + frame_ssim2 = vpx_highbd_calc_ssim(orig, recon, &weight, (int)cm->bit_depth); } else { - frame_ssim2 = vp9_calc_ssim(orig, recon, &weight); + frame_ssim2 = vpx_calc_ssim(orig, recon, &weight); } #else - frame_ssim2 = vp9_calc_ssim(orig, recon, &weight); + frame_ssim2 = vpx_calc_ssim(orig, recon, &weight); #endif // CONFIG_VP9_HIGHBITDEPTH cpi->worst_ssim= MIN(cpi->worst_ssim, frame_ssim2); @@ -4430,13 +4431,13 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, #if CONFIG_VP9_HIGHBITDEPTH if (cm->use_highbitdepth) { - frame_ssim2 = vp9_highbd_calc_ssim( + frame_ssim2 = vpx_highbd_calc_ssim( orig, &cm->post_proc_buffer, &weight, (int)cm->bit_depth); } else { - frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, &weight); + frame_ssim2 = vpx_calc_ssim(orig, &cm->post_proc_buffer, &weight); } #else - frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, &weight); + frame_ssim2 = vpx_calc_ssim(orig, &cm->post_proc_buffer, &weight); #endif // CONFIG_VP9_HIGHBITDEPTH cpi->summedp_quality += frame_ssim2 * weight; @@ -4471,7 +4472,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, if (!cm->use_highbitdepth) #endif { - double this_inconsistency = vp9_get_ssim_metrics( + double this_inconsistency = vpx_get_ssim_metrics( cpi->Source->y_buffer, cpi->Source->y_stride, cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride, cpi->Source->y_width, cpi->Source->y_height, cpi->ssim_vars, @@ -4491,14 +4492,14 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, double y, u, v, frame_all; #if CONFIG_VP9_HIGHBITDEPTH if (cm->use_highbitdepth) { - frame_all = vp9_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y, + frame_all = vpx_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v, (int)cm->bit_depth); } else { - frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, + frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v); } #else - frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v); + frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v); #endif // CONFIG_VP9_HIGHBITDEPTH adjust_image_stat(y, u, v, frame_all, &cpi->ssimg); } @@ -4507,7 +4508,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, #endif { double y, u, v, frame_all; - frame_all = vp9_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u, + frame_all = vpx_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u, &v); adjust_image_stat(y, u, v, frame_all, &cpi->fastssim); /* TODO(JBB): add 10/12 bit support */ @@ -4517,7 +4518,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, #endif { double y, u, v, frame_all; - frame_all = vp9_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v); + frame_all = vpx_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v); adjust_image_stat(y, u, v, frame_all, &cpi->psnrhvs); } } @@ -4574,7 +4575,7 @@ int vp9_get_preview_raw_frame(VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest, ret = -1; } #endif // !CONFIG_VP9_POSTPROC - vp9_clear_system_state(); + vpx_clear_system_state(); return ret; } } |