| Index: source/libvpx/vp8/encoder/onyx_if.c
|
| diff --git a/source/libvpx/vp8/encoder/onyx_if.c b/source/libvpx/vp8/encoder/onyx_if.c
|
| index c2a7ac4cea52c294faa25c2bf8bc31b4977a072d..30a0477442bc636f083edcce0f3e87db729ec1e8 100644
|
| --- a/source/libvpx/vp8/encoder/onyx_if.c
|
| +++ b/source/libvpx/vp8/encoder/onyx_if.c
|
| @@ -17,7 +17,7 @@
|
| #include "vp8/common/blockd.h"
|
| #include "onyx_int.h"
|
| #include "vp8/common/systemdependent.h"
|
| -#include "quantize.h"
|
| +#include "vp8/encoder/quantize.h"
|
| #include "vp8/common/alloccommon.h"
|
| #include "mcomp.h"
|
| #include "firstpass.h"
|
| @@ -74,26 +74,7 @@ extern const int vp8_gf_interval_table[101];
|
|
|
| #if CONFIG_INTERNAL_STATS
|
| #include "math.h"
|
| -
|
| -extern double vp8_calc_ssim
|
| -(
|
| - YV12_BUFFER_CONFIG *source,
|
| - YV12_BUFFER_CONFIG *dest,
|
| - int lumamask,
|
| - double *weight
|
| -);
|
| -
|
| -
|
| -extern double vp8_calc_ssimg
|
| -(
|
| - YV12_BUFFER_CONFIG *source,
|
| - YV12_BUFFER_CONFIG *dest,
|
| - double *ssim_y,
|
| - double *ssim_u,
|
| - double *ssim_v
|
| -);
|
| -
|
| -
|
| +#include "vpx_dsp/ssim.h"
|
| #endif
|
|
|
|
|
| @@ -535,41 +516,6 @@ static void set_segment_data(VP8_COMP *cpi, signed char *feature_data, unsigned
|
| }
|
|
|
|
|
| -static void segmentation_test_function(VP8_COMP *cpi)
|
| -{
|
| - unsigned char *seg_map;
|
| - signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
|
| -
|
| - // Create a temporary map for segmentation data.
|
| - CHECK_MEM_ERROR(seg_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_cols, 1));
|
| -
|
| - // Set the segmentation Map
|
| - set_segmentation_map(cpi, seg_map);
|
| -
|
| - // Activate segmentation.
|
| - enable_segmentation(cpi);
|
| -
|
| - // Set up the quant segment data
|
| - feature_data[MB_LVL_ALT_Q][0] = 0;
|
| - feature_data[MB_LVL_ALT_Q][1] = 4;
|
| - feature_data[MB_LVL_ALT_Q][2] = 0;
|
| - feature_data[MB_LVL_ALT_Q][3] = 0;
|
| - // Set up the loop segment data
|
| - feature_data[MB_LVL_ALT_LF][0] = 0;
|
| - feature_data[MB_LVL_ALT_LF][1] = 0;
|
| - feature_data[MB_LVL_ALT_LF][2] = 0;
|
| - feature_data[MB_LVL_ALT_LF][3] = 0;
|
| -
|
| - // Initialise the feature data structure
|
| - // SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
|
| - set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA);
|
| -
|
| - // Delete sementation map
|
| - vpx_free(seg_map);
|
| -
|
| - seg_map = 0;
|
| -}
|
| -
|
| /* A simple function to cyclically refresh the background at a lower Q */
|
| static void cyclic_background_refresh(VP8_COMP *cpi, int Q, int lf_adjustment)
|
| {
|
| @@ -932,7 +878,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
|
| Speed = cpi->Speed;
|
| switch (Mode)
|
| {
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
| case 0: /* best quality mode */
|
| sf->first_step = 0;
|
| sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
|
| @@ -2084,7 +2030,7 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
|
|
|
| cpi->output_pkt_list = oxcf->output_pkt_list;
|
|
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
|
|
| if (cpi->pass == 1)
|
| {
|
| @@ -2246,7 +2192,7 @@ void vp8_remove_compressor(VP8_COMP **ptr)
|
|
|
| if (cpi && (cpi->common.current_video_frame > 0))
|
| {
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
|
|
| if (cpi->pass == 2)
|
| {
|
| @@ -3037,6 +2983,7 @@ static void update_rd_ref_frame_probs(VP8_COMP *cpi)
|
| }
|
|
|
|
|
| +#if !CONFIG_REALTIME_ONLY
|
| /* 1 = key, 0 = inter */
|
| static int decide_key_frame(VP8_COMP *cpi)
|
| {
|
| @@ -3104,7 +3051,6 @@ static int decide_key_frame(VP8_COMP *cpi)
|
|
|
| }
|
|
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| static void Pass1Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned int *frame_flags)
|
| {
|
| (void) size;
|
| @@ -3150,6 +3096,7 @@ void write_cx_frame_to_file(YV12_BUFFER_CONFIG *frame, int this_frame)
|
| #endif
|
| /* return of 0 means drop frame */
|
|
|
| +#if !CONFIG_REALTIME_ONLY
|
| /* Function to test for conditions that indeicate we should loop
|
| * back and recode a frame.
|
| */
|
| @@ -3199,6 +3146,7 @@ static int recode_loop_test( VP8_COMP *cpi,
|
|
|
| return force_recode;
|
| }
|
| +#endif // !CONFIG_REALTIME_ONLY
|
|
|
| static void update_reference_frames(VP8_COMP *cpi)
|
| {
|
| @@ -3620,7 +3568,7 @@ static void encode_frame_to_data_rate
|
| VP8_COMMON *cm = &cpi->common;
|
| int active_worst_qchanged = 0;
|
|
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
| int q_low;
|
| int q_high;
|
| int zbin_oq_high;
|
| @@ -3659,7 +3607,7 @@ static void encode_frame_to_data_rate
|
| /* For an alt ref frame in 2 pass we skip the call to the second pass
|
| * function that sets the target bandwidth
|
| */
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
|
|
| if (cpi->pass == 2)
|
| {
|
| @@ -4168,7 +4116,7 @@ static void encode_frame_to_data_rate
|
| /* Determine initial Q to try */
|
| Q = vp8_regulate_q(cpi, cpi->this_frame_target);
|
|
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
|
|
| /* Set highest allowed value for Zbin over quant */
|
| if (cm->frame_type == KEY_FRAME)
|
| @@ -4198,7 +4146,7 @@ static void encode_frame_to_data_rate
|
|
|
| vp8_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_shoot_limit);
|
|
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
| /* Limit Q range for the adaptive loop. */
|
| bottom_index = cpi->active_best_quality;
|
| top_index = cpi->active_worst_quality;
|
| @@ -4429,7 +4377,7 @@ static void encode_frame_to_data_rate
|
| if (cpi->pass != 2 && cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME
|
| && cpi->compressor_speed != 2)
|
| {
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
| if (decide_key_frame(cpi))
|
| {
|
| /* Reset all our sizing numbers and recode */
|
| @@ -4485,9 +4433,9 @@ static void encode_frame_to_data_rate
|
| /* Assume 1 qstep = about 4% on frame size. */
|
| over_size_percent = (int)(over_size_percent * 0.96);
|
| }
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
| top_index = cpi->active_worst_quality;
|
| -#endif
|
| +#endif // !CONFIG_REALTIME_ONLY
|
| /* If we have updated the active max Q do not call
|
| * vp8_update_rate_correction_factors() this loop.
|
| */
|
| @@ -4496,7 +4444,7 @@ static void encode_frame_to_data_rate
|
| else
|
| active_worst_qchanged = 0;
|
|
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
| /* Special case handling for forced key frames */
|
| if ( (cm->frame_type == KEY_FRAME) && cpi->this_key_frame_forced )
|
| {
|
| @@ -5234,7 +5182,7 @@ static void encode_frame_to_data_rate
|
|
|
|
|
| }
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
| static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned char * dest_end, unsigned int *frame_flags)
|
| {
|
|
|
| @@ -5318,7 +5266,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
|
|
|
| cpi->source = NULL;
|
|
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
| /* Should we code an alternate reference frame */
|
| if (cpi->oxcf.error_resilient_mode == 0 &&
|
| cpi->oxcf.play_alternate &&
|
| @@ -5386,7 +5334,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
|
| else
|
| {
|
| *size = 0;
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
|
|
| if (flush && cpi->pass == 1 && !cpi->twopass.first_pass_done)
|
| {
|
| @@ -5579,7 +5527,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
|
|
|
| assert(i < NUM_YV12_BUFFERS );
|
| }
|
| -#if !(CONFIG_REALTIME_ONLY)
|
| +#if !CONFIG_REALTIME_ONLY
|
|
|
| if (cpi->pass == 1)
|
| {
|
| @@ -5741,8 +5689,8 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
|
| cpi->total_sq_error2 += sq_error2;
|
| cpi->totalp += frame_psnr2;
|
|
|
| - frame_ssim2 = vp8_calc_ssim(cpi->Source,
|
| - &cm->post_proc_buffer, 1, &weight);
|
| + frame_ssim2 = vpx_calc_ssim(cpi->Source,
|
| + &cm->post_proc_buffer, &weight);
|
|
|
| cpi->summed_quality += frame_ssim2 * weight;
|
| cpi->summed_weights += weight;
|
| @@ -5772,7 +5720,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
|
| if (cpi->b_calculate_ssimg)
|
| {
|
| double y, u, v, frame_all;
|
| - frame_all = vp8_calc_ssimg(cpi->Source, cm->frame_to_show,
|
| + frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show,
|
| &y, &u, &v);
|
|
|
| if (cpi->oxcf.number_of_layers > 1)
|
|
|