Removal of temporal re sampling code.
authorPaul Wilkins <paulwilkins@google.com>
Sat, 25 Feb 2012 18:13:57 +0000 (18:13 +0000)
committerPaul Wilkins <paulwilkins@google.com>
Sat, 25 Feb 2012 18:13:57 +0000 (18:13 +0000)
For now the interface elements have been left in place
to make sure existing parameter files work but parameters
relating to drop frame wont do anything.

Change-Id: I579ee614726387381c546845dac4bc03c74c6a07

vp8/common/onyx.h
vp8/encoder/onyx_if.c
vp8/encoder/onyx_int.h
vp8/encoder/ratectrl.c
vp8/vp8_cx_iface.c

index 8bbdbf2..97f7108 100644 (file)
@@ -154,10 +154,6 @@ extern "C"
         int best_allowed_q;
         int cq_level;
 
-        // allow internal frame rate alterations
-        int allow_df;
-        int drop_frames_water_mark;
-
         // two pass datarate control
         int two_pass_vbrbias;        // two pass datarate control tweaks
         int two_pass_vbrmin_section;
index 9214a2f..837a395 100644 (file)
@@ -1413,9 +1413,6 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
 
     cpi->cq_target_quality = cpi->oxcf.cq_level;
 
-    // Only allow dropped frames in buffered mode
-    cpi->drop_frames_allowed = cpi->oxcf.allow_df && cpi->buffered_mode;
-
     if (!cm->use_bilinear_mc_filter)
         cm->mcomp_filter_type = SIXTAP;
     else
@@ -1668,11 +1665,6 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
     cpi->avg_q = vp8_convert_qindex_to_q( cpi->oxcf.worst_allowed_q );
     cpi->total_byte_count             = 0;
 
-    cpi->drop_frame                  = 0;
-    cpi->drop_count                  = 0;
-    cpi->max_drop_count               = 0;
-    cpi->max_consec_dropped_frames     = 4;
-
     cpi->rate_correction_factor         = 1.0;
     cpi->key_frame_rate_correction_factor = 1.0;
     cpi->gf_rate_correction_factor  = 1.0;
@@ -2514,7 +2506,6 @@ void write_cx_frame_to_file(YV12_BUFFER_CONFIG *frame, int this_frame)
     fclose(yframe);
 }
 #endif
-// return of 0 means drop frame
 
 // Function to test for conditions that indeicate we should loop
 // back and recode a frame.
@@ -2818,10 +2809,6 @@ static void encode_frame_to_data_rate
 
     int overshoot_seen = FALSE;
     int undershoot_seen = FALSE;
-    int drop_mark = cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100;
-    int drop_mark75 = drop_mark * 2 / 3;
-    int drop_mark50 = drop_mark / 4;
-    int drop_mark25 = drop_mark / 8;
 
     // Clear down mmx registers to allow floating point in what follows
     vp8_clear_system_state();
@@ -2908,81 +2895,6 @@ static void encode_frame_to_data_rate
     // Test code for new segment features
     init_seg_features( cpi );
 
-    if (cpi->drop_frames_allowed)
-    {
-        // The reset to decimation 0 is only done here for one pass.
-        // Once it is set two pass leaves decimation on till the next kf.
-        if ((cpi->buffer_level > drop_mark) && (cpi->decimation_factor > 0))
-            cpi->decimation_factor --;
-
-        if (cpi->buffer_level > drop_mark75 && cpi->decimation_factor > 0)
-            cpi->decimation_factor = 1;
-
-        else if (cpi->buffer_level < drop_mark25 && (cpi->decimation_factor == 2 || cpi->decimation_factor == 3))
-        {
-            cpi->decimation_factor = 3;
-        }
-        else if (cpi->buffer_level < drop_mark50 && (cpi->decimation_factor == 1 || cpi->decimation_factor == 2))
-        {
-            cpi->decimation_factor = 2;
-        }
-        else if (cpi->buffer_level < drop_mark75 && (cpi->decimation_factor == 0 || cpi->decimation_factor == 1))
-        {
-            cpi->decimation_factor = 1;
-        }
-
-        //vpx_log("Encoder: Decimation Factor: %d \n",cpi->decimation_factor);
-    }
-
-    // The following decimates the frame rate according to a regular pattern (i.e. to 1/2 or 2/3 frame rate)
-    // This can be used to help prevent buffer under-run in CBR mode. Alternatively it might be desirable in
-    // some situations to drop frame rate but throw more bits at each frame.
-    //
-    // Note that dropping a key frame can be problematic if spatial resampling is also active
-    if (cpi->decimation_factor > 0)
-    {
-        switch (cpi->decimation_factor)
-        {
-        case 1:
-            cpi->per_frame_bandwidth  = cpi->per_frame_bandwidth * 3 / 2;
-            break;
-        case 2:
-            cpi->per_frame_bandwidth  = cpi->per_frame_bandwidth * 5 / 4;
-            break;
-        case 3:
-            cpi->per_frame_bandwidth  = cpi->per_frame_bandwidth * 5 / 4;
-            break;
-        }
-
-        // Note that we should not throw out a key frame (especially when spatial resampling is enabled).
-        if ((cm->frame_type == KEY_FRAME))
-        {
-            cpi->decimation_count = cpi->decimation_factor;
-        }
-        else if (cpi->decimation_count > 0)
-        {
-            cpi->decimation_count --;
-            cpi->bits_off_target += cpi->av_per_frame_bandwidth;
-
-            // Clip the buffer level at the maximum buffer size
-            if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size)
-                cpi->bits_off_target = cpi->oxcf.maximum_buffer_size;
-
-            cm->current_video_frame++;
-            cpi->frames_since_key++;
-
-#if CONFIG_INTERNAL_STATS
-            cpi->count ++;
-#endif
-
-            cpi->buffer_level = cpi->bits_off_target;
-
-            return;
-        }
-        else
-            cpi->decimation_count = cpi->decimation_factor;
-    }
-
     // Decide how big to make the frame
     if (!vp8_pick_frame_size(cpi))
     {
@@ -3608,17 +3520,6 @@ static void encode_frame_to_data_rate
         cpi->ni_av_qi = (cpi->ni_tot_qi / cpi->ni_frames);
     }
 
-    // Set the count for maximum consequative dropped frames based upon the ratio of
-    // this frame size to the target average per frame bandwidth.
-    // (cpi->av_per_frame_bandwidth > 0) is just a sanity check to prevent / 0.
-    if (cpi->drop_frames_allowed && (cpi->av_per_frame_bandwidth > 0))
-    {
-        cpi->max_drop_count = cpi->projected_frame_size / cpi->av_per_frame_bandwidth;
-
-        if (cpi->max_drop_count > cpi->max_consec_dropped_frames)
-            cpi->max_drop_count = cpi->max_consec_dropped_frames;
-    }
-
     // Update the buffer level variable.
     // Non-viewable frames are a special case and are treated as pure overhead.
     if ( !cm->show_frame )
index 4963832..f883ea5 100644 (file)
@@ -436,13 +436,6 @@ typedef struct VP8_COMP
 
     int cq_target_quality;
 
-    int drop_frames_allowed;          // Are we permitted to drop frames?
-    int drop_frame;                  // Drop this frame?
-    int drop_count;                  // How many frames have we dropped?
-    int max_drop_count;               // How many frames should we drop?
-    int max_consec_dropped_frames;     // Limit number of consecutive frames that can be dropped.
-
-
     int ymode_count [VP8_YMODES];        /* intra MB type cts this frame */
     int uv_mode_count[VP8_UV_MODES];       /* intra MB type cts this frame */
 
index 0816955..2a86fc0 100644 (file)
@@ -738,16 +738,7 @@ int vp8_pick_frame_size(VP8_COMP *cpi)
     if (cm->frame_type == KEY_FRAME)
         calc_iframe_target_size(cpi);
     else
-    {
         calc_pframe_target_size(cpi);
 
-        // Check if we're dropping the frame:
-        if (cpi->drop_frame)
-        {
-            cpi->drop_frame = FALSE;
-            cpi->drop_count++;
-            return 0;
-        }
-    }
     return 1;
 }
index 670811a..47d3f25 100644 (file)
@@ -269,9 +269,6 @@ static vpx_codec_err_t set_vp8e_config(VP8_CONFIG *oxcf,
         oxcf->lag_in_frames           = cfg.g_lag_in_frames;
     }
 
-    oxcf->allow_df               = (cfg.rc_dropframe_thresh > 0);
-    oxcf->drop_frames_water_mark   = cfg.rc_dropframe_thresh;
-
     // VBR only supported for now.
     // CBR code has been deprectated for experimental phase.
     // CQ mode not yet tested
@@ -343,8 +340,6 @@ static vpx_codec_err_t set_vp8e_config(VP8_CONFIG *oxcf,
         printf("fixed_q: %d\n",  oxcf->fixed_q);
         printf("worst_allowed_q: %d\n", oxcf->worst_allowed_q);
         printf("best_allowed_q: %d\n", oxcf->best_allowed_q);
-        printf("allow_df: %d\n", oxcf->allow_df);
-        printf("drop_frames_water_mark: %d\n", oxcf->drop_frames_water_mark);
         printf("two_pass_vbrbias: %d\n",  oxcf->two_pass_vbrbias);
         printf("two_pass_vbrmin_section: %d\n", oxcf->two_pass_vbrmin_section);
         printf("two_pass_vbrmax_section: %d\n", oxcf->two_pass_vbrmax_section);