| 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 26 matching lines...) Expand all Loading... |
| 37 #include "vp9/encoder/vp9_variance.h" | 37 #include "vp9/encoder/vp9_variance.h" |
| 38 #if CONFIG_VP9_TEMPORAL_DENOISING | 38 #if CONFIG_VP9_TEMPORAL_DENOISING |
| 39 #include "vp9/encoder/vp9_denoiser.h" | 39 #include "vp9/encoder/vp9_denoiser.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 #ifdef __cplusplus | 42 #ifdef __cplusplus |
| 43 extern "C" { | 43 extern "C" { |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 #define DEFAULT_GF_INTERVAL 10 | 46 #define DEFAULT_GF_INTERVAL 10 |
| 47 #define INVALID_REF_BUFFER_IDX -1 // Marks an invalid reference buffer id. |
| 47 | 48 |
| 48 typedef struct { | 49 typedef struct { |
| 49 int nmvjointcost[MV_JOINTS]; | 50 int nmvjointcost[MV_JOINTS]; |
| 50 int nmvcosts[2][MV_VALS]; | 51 int nmvcosts[2][MV_VALS]; |
| 51 int nmvcosts_hp[2][MV_VALS]; | 52 int nmvcosts_hp[2][MV_VALS]; |
| 52 | 53 |
| 53 vp9_prob segment_pred_probs[PREDICTION_PROBS]; | 54 vp9_prob segment_pred_probs[PREDICTION_PROBS]; |
| 54 | 55 |
| 55 unsigned char *last_frame_seg_map_copy; | 56 unsigned char *last_frame_seg_map_copy; |
| 56 | 57 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } FRAMETYPE_FLAGS; | 103 } FRAMETYPE_FLAGS; |
| 103 | 104 |
| 104 typedef enum { | 105 typedef enum { |
| 105 NO_AQ = 0, | 106 NO_AQ = 0, |
| 106 VARIANCE_AQ = 1, | 107 VARIANCE_AQ = 1, |
| 107 COMPLEXITY_AQ = 2, | 108 COMPLEXITY_AQ = 2, |
| 108 CYCLIC_REFRESH_AQ = 3, | 109 CYCLIC_REFRESH_AQ = 3, |
| 109 AQ_MODE_COUNT // This should always be the last member of the enum | 110 AQ_MODE_COUNT // This should always be the last member of the enum |
| 110 } AQ_MODE; | 111 } AQ_MODE; |
| 111 | 112 |
| 113 typedef enum { |
| 114 RESIZE_NONE = 0, // No frame resizing allowed (except for SVC). |
| 115 RESIZE_FIXED = 1, // All frames are coded at the specified dimension. |
| 116 RESIZE_DYNAMIC = 2 // Coded size of each frame is determined by the codec. |
| 117 } RESIZE_TYPE; |
| 112 | 118 |
| 113 typedef struct VP9EncoderConfig { | 119 typedef struct VP9EncoderConfig { |
| 114 BITSTREAM_PROFILE profile; | 120 BITSTREAM_PROFILE profile; |
| 115 vpx_bit_depth_t bit_depth; // Codec bit-depth. | 121 vpx_bit_depth_t bit_depth; // Codec bit-depth. |
| 116 int width; // width of data passed to the compressor | 122 int width; // width of data passed to the compressor |
| 117 int height; // height of data passed to the compressor | 123 int height; // height of data passed to the compressor |
| 118 unsigned int input_bit_depth; // Input bit depth. | 124 unsigned int input_bit_depth; // Input bit depth. |
| 119 double init_framerate; // set to passed in framerate | 125 double init_framerate; // set to passed in framerate |
| 120 int64_t target_bandwidth; // bandwidth to be used in kilobits per second | 126 int64_t target_bandwidth; // bandwidth to be used in kilobits per second |
| 121 | 127 |
| 122 int noise_sensitivity; // pre processing blur: recommendation 0 | 128 int noise_sensitivity; // pre processing blur: recommendation 0 |
| 123 int sharpness; // sharpening output: recommendation 0: | 129 int sharpness; // sharpening output: recommendation 0: |
| 124 int speed; | 130 int speed; |
| 131 // maximum allowed bitrate for any intra frame in % of bitrate target. |
| 125 unsigned int rc_max_intra_bitrate_pct; | 132 unsigned int rc_max_intra_bitrate_pct; |
| 133 // maximum allowed bitrate for any inter frame in % of bitrate target. |
| 134 unsigned int rc_max_inter_bitrate_pct; |
| 135 // percent of rate boost for golden frame in CBR mode. |
| 136 unsigned int gf_cbr_boost_pct; |
| 126 | 137 |
| 127 MODE mode; | 138 MODE mode; |
| 128 int pass; | 139 int pass; |
| 129 | 140 |
| 130 // Key Framing Operations | 141 // Key Framing Operations |
| 131 int auto_key; // autodetect cut scenes and set the keyframes | 142 int auto_key; // autodetect cut scenes and set the keyframes |
| 132 int key_freq; // maximum distance to key frame. | 143 int key_freq; // maximum distance to key frame. |
| 133 | 144 |
| 134 int lag_in_frames; // how many frames lag before we start encoding | 145 int lag_in_frames; // how many frames lag before we start encoding |
| 135 | 146 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 152 int drop_frames_water_mark; | 163 int drop_frames_water_mark; |
| 153 | 164 |
| 154 // controlling quality | 165 // controlling quality |
| 155 int fixed_q; | 166 int fixed_q; |
| 156 int worst_allowed_q; | 167 int worst_allowed_q; |
| 157 int best_allowed_q; | 168 int best_allowed_q; |
| 158 int cq_level; | 169 int cq_level; |
| 159 AQ_MODE aq_mode; // Adaptive Quantization mode | 170 AQ_MODE aq_mode; // Adaptive Quantization mode |
| 160 | 171 |
| 161 // Internal frame size scaling. | 172 // Internal frame size scaling. |
| 162 int allow_spatial_resampling; | 173 RESIZE_TYPE resize_mode; |
| 163 int scaled_frame_width; | 174 int scaled_frame_width; |
| 164 int scaled_frame_height; | 175 int scaled_frame_height; |
| 165 | 176 |
| 166 // Enable feature to reduce the frame quantization every x frames. | 177 // Enable feature to reduce the frame quantization every x frames. |
| 167 int frame_periodic_boost; | 178 int frame_periodic_boost; |
| 168 | 179 |
| 169 // two pass datarate control | 180 // two pass datarate control |
| 170 int two_pass_vbrbias; // two pass datarate control tweaks | 181 int two_pass_vbrbias; // two pass datarate control tweaks |
| 171 int two_pass_vbrmin_section; | 182 int two_pass_vbrmin_section; |
| 172 int two_pass_vbrmax_section; | 183 int two_pass_vbrmax_section; |
| 173 // END DATARATE CONTROL OPTIONS | 184 // END DATARATE CONTROL OPTIONS |
| 174 // ---------------------------------------------------------------- | 185 // ---------------------------------------------------------------- |
| 175 | 186 |
| 176 // Spatial and temporal scalability. | 187 // Spatial and temporal scalability. |
| 177 int ss_number_layers; // Number of spatial layers. | 188 int ss_number_layers; // Number of spatial layers. |
| 178 int ts_number_layers; // Number of temporal layers. | 189 int ts_number_layers; // Number of temporal layers. |
| 179 // Bitrate allocation for spatial layers. | 190 // Bitrate allocation for spatial layers. |
| 180 int ss_target_bitrate[VPX_SS_MAX_LAYERS]; | 191 int ss_target_bitrate[VPX_SS_MAX_LAYERS]; |
| 181 int ss_play_alternate[VPX_SS_MAX_LAYERS]; | 192 int ss_enable_auto_arf[VPX_SS_MAX_LAYERS]; |
| 182 // Bitrate allocation (CBR mode) and framerate factor, for temporal layers. | 193 // Bitrate allocation (CBR mode) and framerate factor, for temporal layers. |
| 183 int ts_target_bitrate[VPX_TS_MAX_LAYERS]; | 194 int ts_target_bitrate[VPX_TS_MAX_LAYERS]; |
| 184 int ts_rate_decimator[VPX_TS_MAX_LAYERS]; | 195 int ts_rate_decimator[VPX_TS_MAX_LAYERS]; |
| 185 | 196 |
| 186 // these parameters aren't to be used in final build don't use!!! | 197 int enable_auto_arf; |
| 187 int play_alternate; | |
| 188 | 198 |
| 189 int encode_breakout; // early breakout : for video conf recommend 800 | 199 int encode_breakout; // early breakout : for video conf recommend 800 |
| 190 | 200 |
| 191 /* Bitfield defining the error resiliency features to enable. | 201 /* Bitfield defining the error resiliency features to enable. |
| 192 * Can provide decodable frames after losses in previous | 202 * Can provide decodable frames after losses in previous |
| 193 * frames and decodable partitions after losses in the same frame. | 203 * frames and decodable partitions after losses in the same frame. |
| 194 */ | 204 */ |
| 195 unsigned int error_resilient_mode; | 205 unsigned int error_resilient_mode; |
| 196 | 206 |
| 197 /* Bitfield defining the parallel decoding mode where the | 207 /* Bitfield defining the parallel decoding mode where the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 217 vp9e_tune_content content; | 227 vp9e_tune_content content; |
| 218 #if CONFIG_VP9_HIGHBITDEPTH | 228 #if CONFIG_VP9_HIGHBITDEPTH |
| 219 int use_highbitdepth; | 229 int use_highbitdepth; |
| 220 #endif | 230 #endif |
| 221 } VP9EncoderConfig; | 231 } VP9EncoderConfig; |
| 222 | 232 |
| 223 static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) { | 233 static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) { |
| 224 return cfg->best_allowed_q == 0 && cfg->worst_allowed_q == 0; | 234 return cfg->best_allowed_q == 0 && cfg->worst_allowed_q == 0; |
| 225 } | 235 } |
| 226 | 236 |
| 237 // TODO(jingning) All spatially adaptive variables should go to TileDataEnc. |
| 238 typedef struct TileDataEnc { |
| 239 TileInfo tile_info; |
| 240 int thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; |
| 241 int mode_map[BLOCK_SIZES][MAX_MODES]; |
| 242 } TileDataEnc; |
| 243 |
| 244 typedef struct { |
| 245 vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES]; |
| 246 int64_t comp_pred_diff[REFERENCE_MODES]; |
| 247 int64_t tx_select_diff[TX_MODES]; |
| 248 int64_t filter_diff[SWITCHABLE_FILTER_CONTEXTS]; |
| 249 } COUNTS; |
| 250 |
| 227 typedef struct VP9_COMP { | 251 typedef struct VP9_COMP { |
| 228 QUANTS quants; | 252 QUANTS quants; |
| 229 MACROBLOCK mb; | 253 MACROBLOCK mb; |
| 230 VP9_COMMON common; | 254 VP9_COMMON common; |
| 231 VP9EncoderConfig oxcf; | 255 VP9EncoderConfig oxcf; |
| 232 struct lookahead_ctx *lookahead; | 256 struct lookahead_ctx *lookahead; |
| 233 struct lookahead_entry *alt_ref_source; | 257 struct lookahead_entry *alt_ref_source; |
| 234 | 258 |
| 235 YV12_BUFFER_CONFIG *Source; | 259 YV12_BUFFER_CONFIG *Source; |
| 236 YV12_BUFFER_CONFIG *Last_Source; // NULL for first frame and alt_ref frames | 260 YV12_BUFFER_CONFIG *Last_Source; // NULL for first frame and alt_ref frames |
| 237 YV12_BUFFER_CONFIG *un_scaled_source; | 261 YV12_BUFFER_CONFIG *un_scaled_source; |
| 238 YV12_BUFFER_CONFIG scaled_source; | 262 YV12_BUFFER_CONFIG scaled_source; |
| 239 YV12_BUFFER_CONFIG *unscaled_last_source; | 263 YV12_BUFFER_CONFIG *unscaled_last_source; |
| 240 YV12_BUFFER_CONFIG scaled_last_source; | 264 YV12_BUFFER_CONFIG scaled_last_source; |
| 241 | 265 |
| 266 TileDataEnc *tile_data; |
| 267 |
| 242 // For a still frame, this flag is set to 1 to skip partition search. | 268 // For a still frame, this flag is set to 1 to skip partition search. |
| 243 int partition_search_skippable_frame; | 269 int partition_search_skippable_frame; |
| 244 | 270 |
| 245 int scaled_ref_idx[3]; | 271 int scaled_ref_idx[MAX_REF_FRAMES]; |
| 246 int lst_fb_idx; | 272 int lst_fb_idx; |
| 247 int gld_fb_idx; | 273 int gld_fb_idx; |
| 248 int alt_fb_idx; | 274 int alt_fb_idx; |
| 249 | 275 |
| 250 int refresh_last_frame; | 276 int refresh_last_frame; |
| 251 int refresh_golden_frame; | 277 int refresh_golden_frame; |
| 252 int refresh_alt_ref_frame; | 278 int refresh_alt_ref_frame; |
| 253 | 279 |
| 254 int ext_refresh_frame_flags_pending; | 280 int ext_refresh_frame_flags_pending; |
| 255 int ext_refresh_last_frame; | 281 int ext_refresh_last_frame; |
| 256 int ext_refresh_golden_frame; | 282 int ext_refresh_golden_frame; |
| 257 int ext_refresh_alt_ref_frame; | 283 int ext_refresh_alt_ref_frame; |
| 258 | 284 |
| 259 int ext_refresh_frame_context_pending; | 285 int ext_refresh_frame_context_pending; |
| 260 int ext_refresh_frame_context; | 286 int ext_refresh_frame_context; |
| 261 | 287 |
| 262 YV12_BUFFER_CONFIG last_frame_uf; | 288 YV12_BUFFER_CONFIG last_frame_uf; |
| 263 | 289 |
| 264 TOKENEXTRA *tok; | 290 TOKENEXTRA *tok; |
| 265 unsigned int tok_count[4][1 << 6]; | 291 unsigned int tok_count[4][1 << 6]; |
| 266 | 292 |
| 267 // Ambient reconstruction err target for force key frames | 293 // Ambient reconstruction err target for force key frames |
| 268 int ambient_err; | 294 int ambient_err; |
| 269 | 295 |
| 270 RD_OPT rd; | 296 RD_OPT rd; |
| 297 COUNTS *frame_counts; |
| 271 | 298 |
| 272 CODING_CONTEXT coding_context; | 299 CODING_CONTEXT coding_context; |
| 273 | 300 |
| 274 int *nmvcosts[2]; | 301 int *nmvcosts[2]; |
| 275 int *nmvcosts_hp[2]; | 302 int *nmvcosts_hp[2]; |
| 276 int *nmvsadcosts[2]; | 303 int *nmvsadcosts[2]; |
| 277 int *nmvsadcosts_hp[2]; | 304 int *nmvsadcosts_hp[2]; |
| 278 | 305 |
| 279 int zbin_mode_boost; | 306 int zbin_mode_boost; |
| 280 int zbin_mode_boost_enabled; | 307 int zbin_mode_boost_enabled; |
| 281 | 308 |
| 282 int64_t last_time_stamp_seen; | 309 int64_t last_time_stamp_seen; |
| 283 int64_t last_end_time_stamp_seen; | 310 int64_t last_end_time_stamp_seen; |
| 284 int64_t first_time_stamp_ever; | 311 int64_t first_time_stamp_ever; |
| 285 | 312 |
| 286 RATE_CONTROL rc; | 313 RATE_CONTROL rc; |
| 287 double framerate; | 314 double framerate; |
| 288 | 315 |
| 289 vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES]; | |
| 290 int interp_filter_selected[MAX_REF_FRAMES][SWITCHABLE]; | 316 int interp_filter_selected[MAX_REF_FRAMES][SWITCHABLE]; |
| 291 | 317 |
| 292 struct vpx_codec_pkt_list *output_pkt_list; | 318 struct vpx_codec_pkt_list *output_pkt_list; |
| 293 | 319 |
| 294 MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS]; | 320 MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS]; |
| 295 int mbgraph_n_frames; // number of frames filled in the above | 321 int mbgraph_n_frames; // number of frames filled in the above |
| 296 int static_mb_pct; // % forced skip mbs by segmentation | 322 int static_mb_pct; // % forced skip mbs by segmentation |
| 297 int ref_frame_flags; | 323 int ref_frame_flags; |
| 298 | 324 |
| 299 SPEED_FEATURES sf; | 325 SPEED_FEATURES sf; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 312 | 338 |
| 313 // segment threashold for encode breakout | 339 // segment threashold for encode breakout |
| 314 int segment_encode_breakout[MAX_SEGMENTS]; | 340 int segment_encode_breakout[MAX_SEGMENTS]; |
| 315 | 341 |
| 316 unsigned char *complexity_map; | 342 unsigned char *complexity_map; |
| 317 | 343 |
| 318 CYCLIC_REFRESH *cyclic_refresh; | 344 CYCLIC_REFRESH *cyclic_refresh; |
| 319 | 345 |
| 320 fractional_mv_step_fp *find_fractional_mv_step; | 346 fractional_mv_step_fp *find_fractional_mv_step; |
| 321 vp9_full_search_fn_t full_search_sad; | 347 vp9_full_search_fn_t full_search_sad; |
| 322 vp9_refining_search_fn_t refining_search_sad; | |
| 323 vp9_diamond_search_fn_t diamond_search_sad; | 348 vp9_diamond_search_fn_t diamond_search_sad; |
| 324 vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; | 349 vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; |
| 325 uint64_t time_receive_data; | 350 uint64_t time_receive_data; |
| 326 uint64_t time_compress_data; | 351 uint64_t time_compress_data; |
| 327 uint64_t time_pick_lpf; | 352 uint64_t time_pick_lpf; |
| 328 uint64_t time_encode_sb_row; | 353 uint64_t time_encode_sb_row; |
| 329 | 354 |
| 330 #if CONFIG_FP_MB_STATS | 355 #if CONFIG_FP_MB_STATS |
| 331 int use_fp_mb_stats; | 356 int use_fp_mb_stats; |
| 332 #endif | 357 #endif |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 double total_ssimg_all; | 393 double total_ssimg_all; |
| 369 | 394 |
| 370 int b_calculate_ssimg; | 395 int b_calculate_ssimg; |
| 371 #endif | 396 #endif |
| 372 int b_calculate_psnr; | 397 int b_calculate_psnr; |
| 373 | 398 |
| 374 int droppable; | 399 int droppable; |
| 375 | 400 |
| 376 int initial_width; | 401 int initial_width; |
| 377 int initial_height; | 402 int initial_height; |
| 403 int initial_mbs; // Number of MBs in the full-size frame; to be used to |
| 404 // normalize the firstpass stats. This will differ from the |
| 405 // number of MBs in the current frame when the frame is |
| 406 // scaled. |
| 378 | 407 |
| 379 int use_svc; | 408 int use_svc; |
| 380 | 409 |
| 381 SVC svc; | 410 SVC svc; |
| 382 | 411 |
| 383 // Store frame variance info in SOURCE_VAR_BASED_PARTITION search type. | 412 // Store frame variance info in SOURCE_VAR_BASED_PARTITION search type. |
| 384 diff *source_diff_var; | 413 diff *source_diff_var; |
| 385 // The threshold used in SOURCE_VAR_BASED_PARTITION search type. | 414 // The threshold used in SOURCE_VAR_BASED_PARTITION search type. |
| 386 unsigned int source_var_thresh; | 415 unsigned int source_var_thresh; |
| 387 int frames_till_next_var_check; | 416 int frames_till_next_var_check; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 int vp9_set_internal_size(VP9_COMP *cpi, | 476 int vp9_set_internal_size(VP9_COMP *cpi, |
| 448 VPX_SCALING horiz_mode, VPX_SCALING vert_mode); | 477 VPX_SCALING horiz_mode, VPX_SCALING vert_mode); |
| 449 | 478 |
| 450 int vp9_set_size_literal(VP9_COMP *cpi, unsigned int width, | 479 int vp9_set_size_literal(VP9_COMP *cpi, unsigned int width, |
| 451 unsigned int height); | 480 unsigned int height); |
| 452 | 481 |
| 453 void vp9_set_svc(VP9_COMP *cpi, int use_svc); | 482 void vp9_set_svc(VP9_COMP *cpi, int use_svc); |
| 454 | 483 |
| 455 int vp9_get_quantizer(struct VP9_COMP *cpi); | 484 int vp9_get_quantizer(struct VP9_COMP *cpi); |
| 456 | 485 |
| 486 static INLINE int frame_is_kf_gf_arf(const VP9_COMP *cpi) { |
| 487 return frame_is_intra_only(&cpi->common) || |
| 488 cpi->refresh_alt_ref_frame || |
| 489 (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref); |
| 490 } |
| 491 |
| 457 static INLINE int get_ref_frame_idx(const VP9_COMP *cpi, | 492 static INLINE int get_ref_frame_idx(const VP9_COMP *cpi, |
| 458 MV_REFERENCE_FRAME ref_frame) { | 493 MV_REFERENCE_FRAME ref_frame) { |
| 459 if (ref_frame == LAST_FRAME) { | 494 if (ref_frame == LAST_FRAME) { |
| 460 return cpi->lst_fb_idx; | 495 return cpi->lst_fb_idx; |
| 461 } else if (ref_frame == GOLDEN_FRAME) { | 496 } else if (ref_frame == GOLDEN_FRAME) { |
| 462 return cpi->gld_fb_idx; | 497 return cpi->gld_fb_idx; |
| 463 } else { | 498 } else { |
| 464 return cpi->alt_fb_idx; | 499 return cpi->alt_fb_idx; |
| 465 } | 500 } |
| 466 } | 501 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv); | 541 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv); |
| 507 | 542 |
| 508 YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm, | 543 YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm, |
| 509 YV12_BUFFER_CONFIG *unscaled, | 544 YV12_BUFFER_CONFIG *unscaled, |
| 510 YV12_BUFFER_CONFIG *scaled); | 545 YV12_BUFFER_CONFIG *scaled); |
| 511 | 546 |
| 512 void vp9_apply_encoding_flags(VP9_COMP *cpi, vpx_enc_frame_flags_t flags); | 547 void vp9_apply_encoding_flags(VP9_COMP *cpi, vpx_enc_frame_flags_t flags); |
| 513 | 548 |
| 514 static INLINE int is_two_pass_svc(const struct VP9_COMP *const cpi) { | 549 static INLINE int is_two_pass_svc(const struct VP9_COMP *const cpi) { |
| 515 return cpi->use_svc && | 550 return cpi->use_svc && |
| 516 (cpi->svc.number_temporal_layers > 1 || | 551 ((cpi->svc.number_spatial_layers > 1) || |
| 517 cpi->svc.number_spatial_layers > 1) && | 552 (cpi->svc.number_temporal_layers > 1 && cpi->oxcf.pass != 0)); |
| 518 (cpi->oxcf.pass == 1 || cpi->oxcf.pass == 2); | |
| 519 } | 553 } |
| 520 | 554 |
| 521 static INLINE int is_altref_enabled(const VP9_COMP *const cpi) { | 555 static INLINE int is_altref_enabled(const VP9_COMP *const cpi) { |
| 522 return cpi->oxcf.mode != REALTIME && cpi->oxcf.lag_in_frames > 0 && | 556 return cpi->oxcf.mode != REALTIME && cpi->oxcf.lag_in_frames > 0 && |
| 523 (cpi->oxcf.play_alternate && | 557 (cpi->oxcf.enable_auto_arf && |
| 524 (!is_two_pass_svc(cpi) || | 558 (!is_two_pass_svc(cpi) || |
| 525 cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id])); | 559 cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id])); |
| 526 } | 560 } |
| 527 | 561 |
| 528 static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd, | 562 static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 529 MV_REFERENCE_FRAME ref0, | 563 MV_REFERENCE_FRAME ref0, |
| 530 MV_REFERENCE_FRAME ref1) { | 564 MV_REFERENCE_FRAME ref1) { |
| 531 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME | 565 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME |
| 532 : 0]; | 566 : 0]; |
| 533 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME | 567 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME |
| 534 : 0]; | 568 : 0]; |
| 535 } | 569 } |
| 536 | 570 |
| 537 static INLINE int get_chessboard_index(const int frame_index) { | 571 static INLINE int get_chessboard_index(const int frame_index) { |
| 538 return frame_index & 0x1; | 572 return frame_index & 0x1; |
| 539 } | 573 } |
| 540 | 574 |
| 541 static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) { | 575 static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) { |
| 542 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; | 576 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; |
| 543 } | 577 } |
| 544 | 578 |
| 545 #ifdef __cplusplus | 579 #ifdef __cplusplus |
| 546 } // extern "C" | 580 } // extern "C" |
| 547 #endif | 581 #endif |
| 548 | 582 |
| 549 #endif // VP9_ENCODER_VP9_ENCODER_H_ | 583 #endif // VP9_ENCODER_VP9_ENCODER_H_ |
| OLD | NEW |