| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 4  *  Use of this source code is governed by a BSD-style license | 
| 5  *  that can be found in the LICENSE file in the root of the source | 5  *  that can be found in the LICENSE file in the root of the source | 
| 6  *  tree. An additional intellectual property rights grant can be found | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 167     600, 600, 600, 600, 600, 600, 600, 600, | 167     600, 600, 600, 600, 600, 600, 600, 600, | 
| 168     600, 600, 600, 600, 600, 600, 600, 600, | 168     600, 600, 600, 600, 600, 600, 600, 600, | 
| 169     600, 600, 600, 600, 600, 600, 600, 600, | 169     600, 600, 600, 600, 600, 600, 600, 600, | 
| 170     600, 600, 600, 600, 600, 600, 600, 600, | 170     600, 600, 600, 600, 600, 600, 600, 600, | 
| 171     600, 600, 600, 600, 600, 600, 600, 600, | 171     600, 600, 600, 600, 600, 600, 600, 600, | 
| 172     600, 600, 600, 600, 600, 600, 600, 600, | 172     600, 600, 600, 600, 600, 600, 600, 600, | 
| 173     600, 600, 600, 600, 600, 600, 600, 600, | 173     600, 600, 600, 600, 600, 600, 600, 600, | 
| 174     600, 600, 600, 600, 600, 600, 600, 600, | 174     600, 600, 600, 600, 600, 600, 600, 600, | 
| 175 }; | 175 }; | 
| 176 | 176 | 
| 177 /* % adjustment to target kf size based on seperation from previous frame */ |  | 
| 178 static const int kf_boost_seperation_adjustment[16] = |  | 
| 179 { |  | 
| 180     30,   40,   50,   55,   60,   65,   70,   75, |  | 
| 181     80,   85,   90,   95,  100,  100,  100,  100, |  | 
| 182 }; |  | 
| 183 |  | 
| 184 |  | 
| 185 static const int gf_adjust_table[101] = | 177 static const int gf_adjust_table[101] = | 
| 186 { | 178 { | 
| 187     100, | 179     100, | 
| 188     115, 130, 145, 160, 175, 190, 200, 210, 220, 230, | 180     115, 130, 145, 160, 175, 190, 200, 210, 220, 230, | 
| 189     240, 260, 270, 280, 290, 300, 310, 320, 330, 340, | 181     240, 260, 270, 280, 290, 300, 310, 320, 330, 340, | 
| 190     350, 360, 370, 380, 390, 400, 400, 400, 400, 400, | 182     350, 360, 370, 380, 390, 400, 400, 400, 400, 400, | 
| 191     400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | 183     400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | 
| 192     400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | 184     400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | 
| 193     400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | 185     400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | 
| 194     400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | 186     400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | 
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 949                     (cpi->buffer_level * 100) / cpi->oxcf.optimal_buffer_level); | 941                     (cpi->buffer_level * 100) / cpi->oxcf.optimal_buffer_level); | 
| 950             fclose(f); | 942             fclose(f); | 
| 951 #endif | 943 #endif | 
| 952             cpi->drop_frame = 1; | 944             cpi->drop_frame = 1; | 
| 953 | 945 | 
| 954             /* Update the buffer level variable. */ | 946             /* Update the buffer level variable. */ | 
| 955             cpi->bits_off_target += cpi->av_per_frame_bandwidth; | 947             cpi->bits_off_target += cpi->av_per_frame_bandwidth; | 
| 956             if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size) | 948             if (cpi->bits_off_target > cpi->oxcf.maximum_buffer_size) | 
| 957               cpi->bits_off_target = (int)cpi->oxcf.maximum_buffer_size; | 949               cpi->bits_off_target = (int)cpi->oxcf.maximum_buffer_size; | 
| 958             cpi->buffer_level = cpi->bits_off_target; | 950             cpi->buffer_level = cpi->bits_off_target; | 
|  | 951 | 
|  | 952             if (cpi->oxcf.number_of_layers > 1) { | 
|  | 953               unsigned int i; | 
|  | 954 | 
|  | 955               // Propagate bits saved by dropping the frame to higher layers. | 
|  | 956               for (i = cpi->current_layer + 1; i < cpi->oxcf.number_of_layers; | 
|  | 957                   i++) { | 
|  | 958                 LAYER_CONTEXT *lc = &cpi->layer_context[i]; | 
|  | 959                 lc->bits_off_target += (int)(lc->target_bandwidth / | 
|  | 960                                              lc->framerate); | 
|  | 961                 if (lc->bits_off_target > lc->maximum_buffer_size) | 
|  | 962                   lc->bits_off_target = lc->maximum_buffer_size; | 
|  | 963                 lc->buffer_level = lc->bits_off_target; | 
|  | 964               } | 
|  | 965             } | 
| 959         } | 966         } | 
| 960     } | 967     } | 
| 961 | 968 | 
| 962     /* Adjust target frame size for Golden Frames: */ | 969     /* Adjust target frame size for Golden Frames: */ | 
| 963     if (cpi->oxcf.error_resilient_mode == 0 && | 970     if (cpi->oxcf.error_resilient_mode == 0 && | 
| 964         (cpi->frames_till_gf_update_due == 0) && !cpi->drop_frame) | 971         (cpi->frames_till_gf_update_due == 0) && !cpi->drop_frame) | 
| 965     { | 972     { | 
| 966         int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.f
      ixed_q; | 973         int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.f
      ixed_q; | 
| 967 | 974 | 
| 968         int gf_frame_useage = 0;      /* Golden frame useage since last GF */ | 975         int gf_frame_useage = 0;      /* Golden frame useage since last GF */ | 
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1216         else if (cpi->oxcf.number_of_layers == 1 && | 1223         else if (cpi->oxcf.number_of_layers == 1 && | 
| 1217             cpi->common.refresh_alt_ref_frame) | 1224             cpi->common.refresh_alt_ref_frame) | 
| 1218         { | 1225         { | 
| 1219             Q = cpi->oxcf.alt_q; | 1226             Q = cpi->oxcf.alt_q; | 
| 1220         } | 1227         } | 
| 1221         else if (cpi->oxcf.number_of_layers == 1  && | 1228         else if (cpi->oxcf.number_of_layers == 1  && | 
| 1222             cpi->common.refresh_golden_frame) | 1229             cpi->common.refresh_golden_frame) | 
| 1223         { | 1230         { | 
| 1224             Q = cpi->oxcf.gold_q; | 1231             Q = cpi->oxcf.gold_q; | 
| 1225         } | 1232         } | 
| 1226 |  | 
| 1227     } | 1233     } | 
| 1228     else | 1234     else | 
| 1229     { | 1235     { | 
| 1230         int i; | 1236         int i; | 
| 1231         int last_error = INT_MAX; | 1237         int last_error = INT_MAX; | 
| 1232         int target_bits_per_mb; | 1238         int target_bits_per_mb; | 
| 1233         int bits_per_mb_at_this_q; | 1239         int bits_per_mb_at_this_q; | 
| 1234         double correction_factor; | 1240         double correction_factor; | 
| 1235 | 1241 | 
| 1236         /* Select the appropriate correction factor based upon type of frame. */ | 1242         /* Select the appropriate correction factor based upon type of frame. */ | 
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1540 | 1546 | 
| 1541         /* Check if we're dropping the frame: */ | 1547         /* Check if we're dropping the frame: */ | 
| 1542         if (cpi->drop_frame) | 1548         if (cpi->drop_frame) | 
| 1543         { | 1549         { | 
| 1544             cpi->drop_frame = 0; | 1550             cpi->drop_frame = 0; | 
| 1545             return 0; | 1551             return 0; | 
| 1546         } | 1552         } | 
| 1547     } | 1553     } | 
| 1548     return 1; | 1554     return 1; | 
| 1549 } | 1555 } | 
| OLD | NEW | 
|---|