| 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 |
| 11 #ifndef VP9_ENCODER_VP9_ENCODER_H_ | 11 #ifndef VP9_ENCODER_VP9_ENCODER_H_ |
| 12 #define VP9_ENCODER_VP9_ENCODER_H_ | 12 #define VP9_ENCODER_VP9_ENCODER_H_ |
| 13 | 13 |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 | 15 |
| 16 #include "./vpx_config.h" | 16 #include "./vpx_config.h" |
| 17 #include "vpx_ports/mem.h" | 17 #include "vpx_ports/mem.h" |
| 18 #include "vpx/internal/vpx_codec_internal.h" | 18 #include "vpx/internal/vpx_codec_internal.h" |
| 19 #include "vpx/vp8cx.h" | 19 #include "vpx/vp8cx.h" |
| 20 | 20 |
| 21 #include "vp9/common/vp9_ppflags.h" | 21 #include "vp9/common/vp9_ppflags.h" |
| 22 #include "vp9/common/vp9_entropy.h" | 22 #include "vp9/common/vp9_entropy.h" |
| 23 #include "vp9/common/vp9_entropymode.h" | 23 #include "vp9/common/vp9_entropymode.h" |
| 24 #include "vp9/common/vp9_onyxc_int.h" | 24 #include "vp9/common/vp9_onyxc_int.h" |
| 25 | 25 |
| 26 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" | 26 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" |
| 27 #include "vp9/encoder/vp9_context_tree.h" |
| 27 #include "vp9/encoder/vp9_encodemb.h" | 28 #include "vp9/encoder/vp9_encodemb.h" |
| 28 #include "vp9/encoder/vp9_firstpass.h" | 29 #include "vp9/encoder/vp9_firstpass.h" |
| 29 #include "vp9/encoder/vp9_lookahead.h" | 30 #include "vp9/encoder/vp9_lookahead.h" |
| 30 #include "vp9/encoder/vp9_mbgraph.h" | 31 #include "vp9/encoder/vp9_mbgraph.h" |
| 31 #include "vp9/encoder/vp9_mcomp.h" | 32 #include "vp9/encoder/vp9_mcomp.h" |
| 32 #include "vp9/encoder/vp9_quantize.h" | 33 #include "vp9/encoder/vp9_quantize.h" |
| 33 #include "vp9/encoder/vp9_ratectrl.h" | 34 #include "vp9/encoder/vp9_ratectrl.h" |
| 35 #include "vp9/encoder/vp9_rdopt.h" |
| 34 #include "vp9/encoder/vp9_speed_features.h" | 36 #include "vp9/encoder/vp9_speed_features.h" |
| 35 #include "vp9/encoder/vp9_svc_layercontext.h" | 37 #include "vp9/encoder/vp9_svc_layercontext.h" |
| 36 #include "vp9/encoder/vp9_tokenize.h" | 38 #include "vp9/encoder/vp9_tokenize.h" |
| 37 #include "vp9/encoder/vp9_variance.h" | 39 #include "vp9/encoder/vp9_variance.h" |
| 40 #if CONFIG_DENOISING |
| 41 #include "vp9/encoder/vp9_denoiser.h" |
| 42 #endif |
| 38 | 43 |
| 39 #ifdef __cplusplus | 44 #ifdef __cplusplus |
| 40 extern "C" { | 45 extern "C" { |
| 41 #endif | 46 #endif |
| 42 | 47 |
| 43 #define DEFAULT_GF_INTERVAL 10 | 48 #define DEFAULT_GF_INTERVAL 10 |
| 44 | 49 |
| 45 #define MAX_MODES 30 | |
| 46 #define MAX_REFS 6 | |
| 47 | |
| 48 typedef struct { | 50 typedef struct { |
| 49 int nmvjointcost[MV_JOINTS]; | 51 int nmvjointcost[MV_JOINTS]; |
| 50 int nmvcosts[2][MV_VALS]; | 52 int nmvcosts[2][MV_VALS]; |
| 51 int nmvcosts_hp[2][MV_VALS]; | 53 int nmvcosts_hp[2][MV_VALS]; |
| 52 | 54 |
| 53 vp9_prob segment_pred_probs[PREDICTION_PROBS]; | 55 vp9_prob segment_pred_probs[PREDICTION_PROBS]; |
| 54 | 56 |
| 55 unsigned char *last_frame_seg_map_copy; | 57 unsigned char *last_frame_seg_map_copy; |
| 56 | 58 |
| 57 // 0 = Intra, Last, GF, ARF | 59 // 0 = Intra, Last, GF, ARF |
| 58 signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; | 60 signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; |
| 59 // 0 = ZERO_MV, MV | 61 // 0 = ZERO_MV, MV |
| 60 signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; | 62 signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; |
| 61 | 63 |
| 62 FRAME_CONTEXT fc; | 64 FRAME_CONTEXT fc; |
| 63 } CODING_CONTEXT; | 65 } CODING_CONTEXT; |
| 64 | 66 |
| 65 // This enumerator type needs to be kept aligned with the mode order in | |
| 66 // const MODE_DEFINITION vp9_mode_order[MAX_MODES] used in the rd code. | |
| 67 typedef enum { | |
| 68 THR_NEARESTMV, | |
| 69 THR_NEARESTA, | |
| 70 THR_NEARESTG, | |
| 71 | |
| 72 THR_DC, | |
| 73 | |
| 74 THR_NEWMV, | |
| 75 THR_NEWA, | |
| 76 THR_NEWG, | |
| 77 | |
| 78 THR_NEARMV, | |
| 79 THR_NEARA, | |
| 80 THR_COMP_NEARESTLA, | |
| 81 THR_COMP_NEARESTGA, | |
| 82 | |
| 83 THR_TM, | |
| 84 | |
| 85 THR_COMP_NEARLA, | |
| 86 THR_COMP_NEWLA, | |
| 87 THR_NEARG, | |
| 88 THR_COMP_NEARGA, | |
| 89 THR_COMP_NEWGA, | |
| 90 | |
| 91 THR_ZEROMV, | |
| 92 THR_ZEROG, | |
| 93 THR_ZEROA, | |
| 94 THR_COMP_ZEROLA, | |
| 95 THR_COMP_ZEROGA, | |
| 96 | |
| 97 THR_H_PRED, | |
| 98 THR_V_PRED, | |
| 99 THR_D135_PRED, | |
| 100 THR_D207_PRED, | |
| 101 THR_D153_PRED, | |
| 102 THR_D63_PRED, | |
| 103 THR_D117_PRED, | |
| 104 THR_D45_PRED, | |
| 105 } THR_MODES; | |
| 106 | |
| 107 typedef enum { | |
| 108 THR_LAST, | |
| 109 THR_GOLD, | |
| 110 THR_ALTR, | |
| 111 THR_COMP_LA, | |
| 112 THR_COMP_GA, | |
| 113 THR_INTRA, | |
| 114 } THR_MODES_SUB8X8; | |
| 115 | 67 |
| 116 typedef enum { | 68 typedef enum { |
| 117 // encode_breakout is disabled. | 69 // encode_breakout is disabled. |
| 118 ENCODE_BREAKOUT_DISABLED = 0, | 70 ENCODE_BREAKOUT_DISABLED = 0, |
| 119 // encode_breakout is enabled. | 71 // encode_breakout is enabled. |
| 120 ENCODE_BREAKOUT_ENABLED = 1, | 72 ENCODE_BREAKOUT_ENABLED = 1, |
| 121 // encode_breakout is enabled with small max_thresh limit. | 73 // encode_breakout is enabled with small max_thresh limit. |
| 122 ENCODE_BREAKOUT_LIMITED = 2 | 74 ENCODE_BREAKOUT_LIMITED = 2 |
| 123 } ENCODE_BREAKOUT_TYPE; | 75 } ENCODE_BREAKOUT_TYPE; |
| 124 | 76 |
| 125 typedef enum { | 77 typedef enum { |
| 126 NORMAL = 0, | 78 NORMAL = 0, |
| 127 FOURFIVE = 1, | 79 FOURFIVE = 1, |
| 128 THREEFIVE = 2, | 80 THREEFIVE = 2, |
| 129 ONETWO = 3 | 81 ONETWO = 3 |
| 130 } VPX_SCALING; | 82 } VPX_SCALING; |
| 131 | 83 |
| 132 typedef enum { | 84 typedef enum { |
| 133 RC_MODE_VBR = 0, | |
| 134 RC_MODE_CBR = 1, | |
| 135 RC_MODE_CONSTRAINED_QUALITY = 2, | |
| 136 RC_MODE_CONSTANT_QUALITY = 3, | |
| 137 } RC_MODE; | |
| 138 | |
| 139 typedef enum { | |
| 140 // Good Quality Fast Encoding. The encoder balances quality with the | 85 // Good Quality Fast Encoding. The encoder balances quality with the |
| 141 // amount of time it takes to encode the output. (speed setting | 86 // amount of time it takes to encode the output. (speed setting |
| 142 // controls how fast) | 87 // controls how fast) |
| 143 ONE_PASS_GOOD = 1, | 88 ONE_PASS_GOOD = 1, |
| 144 | 89 |
| 145 // One Pass - Best Quality. The encoder places priority on the | 90 // One Pass - Best Quality. The encoder places priority on the |
| 146 // quality of the output over encoding speed. The output is compressed | 91 // quality of the output over encoding speed. The output is compressed |
| 147 // at the highest possible quality. This option takes the longest | 92 // at the highest possible quality. This option takes the longest |
| 148 // amount of time to encode. (speed setting ignored) | 93 // amount of time to encode. (speed setting ignored) |
| 149 ONE_PASS_BEST = 2, | 94 ONE_PASS_BEST = 2, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 146 |
| 202 // Key Framing Operations | 147 // Key Framing Operations |
| 203 int auto_key; // autodetect cut scenes and set the keyframes | 148 int auto_key; // autodetect cut scenes and set the keyframes |
| 204 int key_freq; // maximum distance to key frame. | 149 int key_freq; // maximum distance to key frame. |
| 205 | 150 |
| 206 int lag_in_frames; // how many frames lag before we start encoding | 151 int lag_in_frames; // how many frames lag before we start encoding |
| 207 | 152 |
| 208 // ---------------------------------------------------------------- | 153 // ---------------------------------------------------------------- |
| 209 // DATARATE CONTROL OPTIONS | 154 // DATARATE CONTROL OPTIONS |
| 210 | 155 |
| 211 RC_MODE rc_mode; // vbr, cbr, constrained quality or constant quality | 156 // vbr, cbr, constrained quality or constant quality |
| 157 enum vpx_rc_mode rc_mode; |
| 212 | 158 |
| 213 // buffer targeting aggressiveness | 159 // buffer targeting aggressiveness |
| 214 int under_shoot_pct; | 160 int under_shoot_pct; |
| 215 int over_shoot_pct; | 161 int over_shoot_pct; |
| 216 | 162 |
| 217 // buffering parameters | 163 // buffering parameters |
| 218 int64_t starting_buffer_level; // in seconds | 164 int64_t starting_buffer_level_ms; |
| 219 int64_t optimal_buffer_level; | 165 int64_t optimal_buffer_level_ms; |
| 220 int64_t maximum_buffer_size; | 166 int64_t maximum_buffer_size_ms; |
| 221 | 167 |
| 222 // Frame drop threshold. | 168 // Frame drop threshold. |
| 223 int drop_frames_water_mark; | 169 int drop_frames_water_mark; |
| 224 | 170 |
| 225 // controlling quality | 171 // controlling quality |
| 226 int fixed_q; | 172 int fixed_q; |
| 227 int worst_allowed_q; | 173 int worst_allowed_q; |
| 228 int best_allowed_q; | 174 int best_allowed_q; |
| 229 int cq_level; | 175 int cq_level; |
| 230 int lossless; | |
| 231 AQ_MODE aq_mode; // Adaptive Quantization mode | 176 AQ_MODE aq_mode; // Adaptive Quantization mode |
| 232 | 177 |
| 233 // Internal frame size scaling. | 178 // Internal frame size scaling. |
| 234 int allow_spatial_resampling; | 179 int allow_spatial_resampling; |
| 235 int scaled_frame_width; | 180 int scaled_frame_width; |
| 236 int scaled_frame_height; | 181 int scaled_frame_height; |
| 237 | 182 |
| 238 // Enable feature to reduce the frame quantization every x frames. | 183 // Enable feature to reduce the frame quantization every x frames. |
| 239 int frame_periodic_boost; | 184 int frame_periodic_boost; |
| 240 | 185 |
| 241 // two pass datarate control | 186 // two pass datarate control |
| 242 int two_pass_vbrbias; // two pass datarate control tweaks | 187 int two_pass_vbrbias; // two pass datarate control tweaks |
| 243 int two_pass_vbrmin_section; | 188 int two_pass_vbrmin_section; |
| 244 int two_pass_vbrmax_section; | 189 int two_pass_vbrmax_section; |
| 245 // END DATARATE CONTROL OPTIONS | 190 // END DATARATE CONTROL OPTIONS |
| 246 // ---------------------------------------------------------------- | 191 // ---------------------------------------------------------------- |
| 247 | 192 |
| 248 // Spatial and temporal scalability. | 193 // Spatial and temporal scalability. |
| 249 int ss_number_layers; // Number of spatial layers. | 194 int ss_number_layers; // Number of spatial layers. |
| 250 int ts_number_layers; // Number of temporal layers. | 195 int ts_number_layers; // Number of temporal layers. |
| 251 // Bitrate allocation for spatial layers. | 196 // Bitrate allocation for spatial layers. |
| 252 int ss_target_bitrate[VPX_SS_MAX_LAYERS]; | 197 int ss_target_bitrate[VPX_SS_MAX_LAYERS]; |
| 253 // Bitrate allocation (CBR mode) and framerate factor, for temporal layers. | 198 // Bitrate allocation (CBR mode) and framerate factor, for temporal layers. |
| 254 int ts_target_bitrate[VPX_TS_MAX_LAYERS]; | 199 int ts_target_bitrate[VPX_TS_MAX_LAYERS]; |
| 255 int ts_rate_decimator[VPX_TS_MAX_LAYERS]; | 200 int ts_rate_decimator[VPX_TS_MAX_LAYERS]; |
| 256 | 201 |
| 257 // these parameters aren't to be used in final build don't use!!! | 202 // these parameters aren't to be used in final build don't use!!! |
| 258 int play_alternate; | 203 int play_alternate; |
| 259 int alt_freq; | |
| 260 | 204 |
| 261 int encode_breakout; // early breakout : for video conf recommend 800 | 205 int encode_breakout; // early breakout : for video conf recommend 800 |
| 262 | 206 |
| 263 /* Bitfield defining the error resiliency features to enable. | 207 /* Bitfield defining the error resiliency features to enable. |
| 264 * Can provide decodable frames after losses in previous | 208 * Can provide decodable frames after losses in previous |
| 265 * frames and decodable partitions after losses in the same frame. | 209 * frames and decodable partitions after losses in the same frame. |
| 266 */ | 210 */ |
| 267 unsigned int error_resilient_mode; | 211 unsigned int error_resilient_mode; |
| 268 | 212 |
| 269 /* Bitfield defining the parallel decoding mode where the | 213 /* Bitfield defining the parallel decoding mode where the |
| 270 * decoding in successive frames may be conducted in parallel | 214 * decoding in successive frames may be conducted in parallel |
| 271 * just by decoding the frame headers. | 215 * just by decoding the frame headers. |
| 272 */ | 216 */ |
| 273 unsigned int frame_parallel_decoding_mode; | 217 unsigned int frame_parallel_decoding_mode; |
| 274 | 218 |
| 275 int arnr_max_frames; | 219 int arnr_max_frames; |
| 276 int arnr_strength; | 220 int arnr_strength; |
| 277 int arnr_type; | 221 int arnr_type; |
| 278 | 222 |
| 279 int tile_columns; | 223 int tile_columns; |
| 280 int tile_rows; | 224 int tile_rows; |
| 281 | 225 |
| 282 struct vpx_fixed_buf two_pass_stats_in; | 226 struct vpx_fixed_buf two_pass_stats_in; |
| 283 struct vpx_codec_pkt_list *output_pkt_list; | 227 struct vpx_codec_pkt_list *output_pkt_list; |
| 284 | 228 |
| 285 vp8e_tuning tuning; | 229 vp8e_tuning tuning; |
| 286 } VP9EncoderConfig; | 230 } VP9EncoderConfig; |
| 287 | 231 |
| 232 static INLINE int is_altref_enabled(const VP9EncoderConfig *cfg) { |
| 233 return cfg->mode != REALTIME && cfg->play_alternate && cfg->lag_in_frames > 0; |
| 234 } |
| 235 |
| 236 static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) { |
| 237 return cfg->best_allowed_q == 0 && cfg->worst_allowed_q == 0; |
| 238 } |
| 239 |
| 288 static INLINE int is_best_mode(MODE mode) { | 240 static INLINE int is_best_mode(MODE mode) { |
| 289 return mode == ONE_PASS_BEST || mode == TWO_PASS_SECOND_BEST; | 241 return mode == ONE_PASS_BEST || mode == TWO_PASS_SECOND_BEST; |
| 290 } | 242 } |
| 291 | 243 |
| 292 typedef struct RD_OPT { | |
| 293 // Thresh_mult is used to set a threshold for the rd score. A higher value | |
| 294 // means that we will accept the best mode so far more often. This number | |
| 295 // is used in combination with the current block size, and thresh_freq_fact | |
| 296 // to pick a threshold. | |
| 297 int thresh_mult[MAX_MODES]; | |
| 298 int thresh_mult_sub8x8[MAX_REFS]; | |
| 299 | |
| 300 int threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES]; | |
| 301 int thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; | |
| 302 | |
| 303 int64_t comp_pred_diff[REFERENCE_MODES]; | |
| 304 int64_t prediction_type_threshes[MAX_REF_FRAMES][REFERENCE_MODES]; | |
| 305 int64_t tx_select_diff[TX_MODES]; | |
| 306 // FIXME(rbultje) can this overflow? | |
| 307 int tx_select_threshes[MAX_REF_FRAMES][TX_MODES]; | |
| 308 | |
| 309 int64_t filter_diff[SWITCHABLE_FILTER_CONTEXTS]; | |
| 310 int64_t filter_threshes[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS]; | |
| 311 int64_t filter_cache[SWITCHABLE_FILTER_CONTEXTS]; | |
| 312 int64_t mask_filter; | |
| 313 | |
| 314 int RDMULT; | |
| 315 int RDDIV; | |
| 316 } RD_OPT; | |
| 317 | |
| 318 typedef struct VP9_COMP { | 244 typedef struct VP9_COMP { |
| 319 QUANTS quants; | 245 QUANTS quants; |
| 320 MACROBLOCK mb; | 246 MACROBLOCK mb; |
| 321 VP9_COMMON common; | 247 VP9_COMMON common; |
| 322 VP9EncoderConfig oxcf; | 248 VP9EncoderConfig oxcf; |
| 323 struct lookahead_ctx *lookahead; | 249 struct lookahead_ctx *lookahead; |
| 324 struct lookahead_entry *source; | 250 struct lookahead_entry *source; |
| 325 #if CONFIG_MULTIPLE_ARF | 251 #if CONFIG_MULTIPLE_ARF |
| 326 struct lookahead_entry *alt_ref_source[REF_FRAMES]; | 252 struct lookahead_entry *alt_ref_source[REF_FRAMES]; |
| 327 #else | 253 #else |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 int ref_frame_flags; | 329 int ref_frame_flags; |
| 404 | 330 |
| 405 SPEED_FEATURES sf; | 331 SPEED_FEATURES sf; |
| 406 | 332 |
| 407 unsigned int max_mv_magnitude; | 333 unsigned int max_mv_magnitude; |
| 408 int mv_step_param; | 334 int mv_step_param; |
| 409 | 335 |
| 410 // Default value is 1. From first pass stats, encode_breakout may be disabled. | 336 // Default value is 1. From first pass stats, encode_breakout may be disabled. |
| 411 ENCODE_BREAKOUT_TYPE allow_encode_breakout; | 337 ENCODE_BREAKOUT_TYPE allow_encode_breakout; |
| 412 | 338 |
| 413 // Get threshold from external input. In real time mode, it can be | 339 // Get threshold from external input. A suggested threshold is 800 for HD |
| 414 // overwritten according to encoding speed. | 340 // clips, and 300 for < HD clips. |
| 415 int encode_breakout; | 341 int encode_breakout; |
| 416 | 342 |
| 417 unsigned char *segmentation_map; | 343 unsigned char *segmentation_map; |
| 418 | 344 |
| 419 // segment threashold for encode breakout | 345 // segment threashold for encode breakout |
| 420 int segment_encode_breakout[MAX_SEGMENTS]; | 346 int segment_encode_breakout[MAX_SEGMENTS]; |
| 421 | 347 |
| 422 unsigned char *complexity_map; | 348 unsigned char *complexity_map; |
| 423 | 349 |
| 424 unsigned char *active_map; | 350 unsigned char *active_map; |
| 425 unsigned int active_map_enabled; | 351 unsigned int active_map_enabled; |
| 426 | 352 |
| 427 CYCLIC_REFRESH *cyclic_refresh; | 353 CYCLIC_REFRESH *cyclic_refresh; |
| 428 | 354 |
| 429 fractional_mv_step_fp *find_fractional_mv_step; | 355 fractional_mv_step_fp *find_fractional_mv_step; |
| 430 fractional_mv_step_comp_fp *find_fractional_mv_step_comp; | 356 fractional_mv_step_comp_fp *find_fractional_mv_step_comp; |
| 431 vp9_full_search_fn_t full_search_sad; | 357 vp9_full_search_fn_t full_search_sad; |
| 432 vp9_refining_search_fn_t refining_search_sad; | 358 vp9_refining_search_fn_t refining_search_sad; |
| 433 vp9_diamond_search_fn_t diamond_search_sad; | 359 vp9_diamond_search_fn_t diamond_search_sad; |
| 434 vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; | 360 vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; |
| 435 uint64_t time_receive_data; | 361 uint64_t time_receive_data; |
| 436 uint64_t time_compress_data; | 362 uint64_t time_compress_data; |
| 437 uint64_t time_pick_lpf; | 363 uint64_t time_pick_lpf; |
| 438 uint64_t time_encode_sb_row; | 364 uint64_t time_encode_sb_row; |
| 439 | 365 |
| 440 struct twopass_rc twopass; | 366 TWO_PASS twopass; |
| 441 | 367 |
| 442 YV12_BUFFER_CONFIG alt_ref_buffer; | 368 YV12_BUFFER_CONFIG alt_ref_buffer; |
| 443 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS]; | 369 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS]; |
| 444 | 370 |
| 445 #if CONFIG_INTERNAL_STATS | 371 #if CONFIG_INTERNAL_STATS |
| 446 unsigned int mode_chosen_counts[MAX_MODES]; | 372 unsigned int mode_chosen_counts[MAX_MODES]; |
| 447 | 373 |
| 448 int count; | 374 int count; |
| 449 double total_y; | 375 double total_y; |
| 450 double total_u; | 376 double total_u; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 int frame_flags; | 421 int frame_flags; |
| 496 | 422 |
| 497 search_site_config ss_cfg; | 423 search_site_config ss_cfg; |
| 498 | 424 |
| 499 int mbmode_cost[INTRA_MODES]; | 425 int mbmode_cost[INTRA_MODES]; |
| 500 unsigned inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES]; | 426 unsigned inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES]; |
| 501 int intra_uv_mode_cost[FRAME_TYPES][INTRA_MODES]; | 427 int intra_uv_mode_cost[FRAME_TYPES][INTRA_MODES]; |
| 502 int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES]; | 428 int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES]; |
| 503 int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; | 429 int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; |
| 504 | 430 |
| 431 PICK_MODE_CONTEXT *leaf_tree; |
| 432 PC_TREE *pc_tree; |
| 433 PC_TREE *pc_root; |
| 434 int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; |
| 435 |
| 505 #if CONFIG_MULTIPLE_ARF | 436 #if CONFIG_MULTIPLE_ARF |
| 506 // ARF tracking variables. | 437 // ARF tracking variables. |
| 507 int multi_arf_enabled; | 438 int multi_arf_enabled; |
| 508 unsigned int frame_coding_order_period; | 439 unsigned int frame_coding_order_period; |
| 509 unsigned int new_frame_coding_order_period; | 440 unsigned int new_frame_coding_order_period; |
| 510 int frame_coding_order[MAX_LAG_BUFFERS * 2]; | 441 int frame_coding_order[MAX_LAG_BUFFERS * 2]; |
| 511 int arf_buffer_idx[MAX_LAG_BUFFERS * 3 / 2]; | 442 int arf_buffer_idx[MAX_LAG_BUFFERS * 3 / 2]; |
| 512 int arf_weight[MAX_LAG_BUFFERS]; | 443 int arf_weight[MAX_LAG_BUFFERS]; |
| 513 int arf_buffered; | 444 int arf_buffered; |
| 514 int this_frame_weight; | 445 int this_frame_weight; |
| 515 int max_arf_level; | 446 int max_arf_level; |
| 516 #endif | 447 #endif |
| 448 |
| 449 #if CONFIG_DENOISING |
| 450 VP9_DENOISER denoiser; |
| 451 #endif |
| 517 } VP9_COMP; | 452 } VP9_COMP; |
| 518 | 453 |
| 519 void vp9_initialize_enc(); | 454 void vp9_initialize_enc(); |
| 520 | 455 |
| 521 struct VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf); | 456 struct VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf); |
| 522 void vp9_remove_compressor(VP9_COMP *cpi); | 457 void vp9_remove_compressor(VP9_COMP *cpi); |
| 523 | 458 |
| 524 void vp9_change_config(VP9_COMP *cpi, const VP9EncoderConfig *oxcf); | 459 void vp9_change_config(VP9_COMP *cpi, const VP9EncoderConfig *oxcf); |
| 525 | 460 |
| 526 // receive a frames worth of data. caller can assume that a copy of this | 461 // receive a frames worth of data. caller can assume that a copy of this |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 550 |
| 616 static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd, | 551 static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 617 MV_REFERENCE_FRAME ref0, | 552 MV_REFERENCE_FRAME ref0, |
| 618 MV_REFERENCE_FRAME ref1) { | 553 MV_REFERENCE_FRAME ref1) { |
| 619 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME | 554 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME |
| 620 : 0]; | 555 : 0]; |
| 621 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME | 556 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME |
| 622 : 0]; | 557 : 0]; |
| 623 } | 558 } |
| 624 | 559 |
| 560 static INLINE int get_chessboard_index(const VP9_COMMON *cm) { |
| 561 return cm->current_video_frame % 2; |
| 562 } |
| 563 |
| 625 #ifdef __cplusplus | 564 #ifdef __cplusplus |
| 626 } // extern "C" | 565 } // extern "C" |
| 627 #endif | 566 #endif |
| 628 | 567 |
| 629 #endif // VP9_ENCODER_VP9_ENCODER_H_ | 568 #endif // VP9_ENCODER_VP9_ENCODER_H_ |
| OLD | NEW |