Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_encoder.h

Issue 478033002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_encodemb.c ('k') | source/libvpx/vp9/encoder/vp9_encoder.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 #include "vp9/encoder/vp9_lookahead.h" 30 #include "vp9/encoder/vp9_lookahead.h"
31 #include "vp9/encoder/vp9_mbgraph.h" 31 #include "vp9/encoder/vp9_mbgraph.h"
32 #include "vp9/encoder/vp9_mcomp.h" 32 #include "vp9/encoder/vp9_mcomp.h"
33 #include "vp9/encoder/vp9_quantize.h" 33 #include "vp9/encoder/vp9_quantize.h"
34 #include "vp9/encoder/vp9_ratectrl.h" 34 #include "vp9/encoder/vp9_ratectrl.h"
35 #include "vp9/encoder/vp9_rd.h" 35 #include "vp9/encoder/vp9_rd.h"
36 #include "vp9/encoder/vp9_speed_features.h" 36 #include "vp9/encoder/vp9_speed_features.h"
37 #include "vp9/encoder/vp9_svc_layercontext.h" 37 #include "vp9/encoder/vp9_svc_layercontext.h"
38 #include "vp9/encoder/vp9_tokenize.h" 38 #include "vp9/encoder/vp9_tokenize.h"
39 #include "vp9/encoder/vp9_variance.h" 39 #include "vp9/encoder/vp9_variance.h"
40 #if CONFIG_DENOISING 40 #if CONFIG_VP9_TEMPORAL_DENOISING
41 #include "vp9/encoder/vp9_denoiser.h" 41 #include "vp9/encoder/vp9_denoiser.h"
42 #endif 42 #endif
43 43
44 #ifdef __cplusplus 44 #ifdef __cplusplus
45 extern "C" { 45 extern "C" {
46 #endif 46 #endif
47 47
48 #define DEFAULT_GF_INTERVAL 10 48 #define DEFAULT_GF_INTERVAL 10
49 49
50 typedef struct { 50 typedef struct {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 CYCLIC_REFRESH_AQ = 3, 127 CYCLIC_REFRESH_AQ = 3,
128 AQ_MODE_COUNT // This should always be the last member of the enum 128 AQ_MODE_COUNT // This should always be the last member of the enum
129 } AQ_MODE; 129 } AQ_MODE;
130 130
131 131
132 typedef struct VP9EncoderConfig { 132 typedef struct VP9EncoderConfig {
133 BITSTREAM_PROFILE profile; 133 BITSTREAM_PROFILE profile;
134 BIT_DEPTH bit_depth; 134 BIT_DEPTH bit_depth;
135 int width; // width of data passed to the compressor 135 int width; // width of data passed to the compressor
136 int height; // height of data passed to the compressor 136 int height; // height of data passed to the compressor
137 double framerate; // set to passed in framerate 137 double init_framerate; // set to passed in framerate
138 int64_t target_bandwidth; // bandwidth to be used in kilobits per second 138 int64_t target_bandwidth; // bandwidth to be used in kilobits per second
139 139
140 int noise_sensitivity; // pre processing blur: recommendation 0 140 int noise_sensitivity; // pre processing blur: recommendation 0
141 int sharpness; // sharpening output: recommendation 0: 141 int sharpness; // sharpening output: recommendation 0:
142 int speed; 142 int speed;
143 unsigned int rc_max_intra_bitrate_pct; 143 unsigned int rc_max_intra_bitrate_pct;
144 144
145 MODE mode; 145 MODE mode;
146 int pass;
146 147
147 // Key Framing Operations 148 // Key Framing Operations
148 int auto_key; // autodetect cut scenes and set the keyframes 149 int auto_key; // autodetect cut scenes and set the keyframes
149 int key_freq; // maximum distance to key frame. 150 int key_freq; // maximum distance to key frame.
150 151
151 int lag_in_frames; // how many frames lag before we start encoding 152 int lag_in_frames; // how many frames lag before we start encoding
152 153
153 // ---------------------------------------------------------------- 154 // ----------------------------------------------------------------
154 // DATARATE CONTROL OPTIONS 155 // DATARATE CONTROL OPTIONS
155 156
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 int tile_rows; 226 int tile_rows;
226 227
227 struct vpx_fixed_buf two_pass_stats_in; 228 struct vpx_fixed_buf two_pass_stats_in;
228 struct vpx_codec_pkt_list *output_pkt_list; 229 struct vpx_codec_pkt_list *output_pkt_list;
229 230
230 #if CONFIG_FP_MB_STATS 231 #if CONFIG_FP_MB_STATS
231 struct vpx_fixed_buf firstpass_mb_stats_in; 232 struct vpx_fixed_buf firstpass_mb_stats_in;
232 #endif 233 #endif
233 234
234 vp8e_tuning tuning; 235 vp8e_tuning tuning;
236 vp9e_tune_content content;
235 } VP9EncoderConfig; 237 } VP9EncoderConfig;
236 238
237 static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) { 239 static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) {
238 return cfg->best_allowed_q == 0 && cfg->worst_allowed_q == 0; 240 return cfg->best_allowed_q == 0 && cfg->worst_allowed_q == 0;
239 } 241 }
240 242
241 static INLINE int is_best_mode(MODE mode) { 243 static INLINE int is_best_mode(MODE mode) {
242 return mode == ONE_PASS_BEST || mode == TWO_PASS_SECOND_BEST; 244 return mode == ONE_PASS_BEST || mode == TWO_PASS_SECOND_BEST;
243 } 245 }
244 246
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 291
290 // Ambient reconstruction err target for force key frames 292 // Ambient reconstruction err target for force key frames
291 int ambient_err; 293 int ambient_err;
292 294
293 RD_OPT rd; 295 RD_OPT rd;
294 296
295 CODING_CONTEXT coding_context; 297 CODING_CONTEXT coding_context;
296 298
297 int zbin_mode_boost; 299 int zbin_mode_boost;
298 int zbin_mode_boost_enabled; 300 int zbin_mode_boost_enabled;
299 int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames
300 int active_arnr_strength; // <= cpi->oxcf.arnr_max_strength
301 301
302 int64_t last_time_stamp_seen; 302 int64_t last_time_stamp_seen;
303 int64_t last_end_time_stamp_seen; 303 int64_t last_end_time_stamp_seen;
304 int64_t first_time_stamp_ever; 304 int64_t first_time_stamp_ever;
305 305
306 RATE_CONTROL rc; 306 RATE_CONTROL rc;
307 double framerate;
307 308
308 vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES]; 309 vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES];
309 310
310 struct vpx_codec_pkt_list *output_pkt_list; 311 struct vpx_codec_pkt_list *output_pkt_list;
311 312
312 MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS]; 313 MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS];
313 int mbgraph_n_frames; // number of frames filled in the above 314 int mbgraph_n_frames; // number of frames filled in the above
314 int static_mb_pct; // % forced skip mbs by segmentation 315 int static_mb_pct; // % forced skip mbs by segmentation
315
316 int pass;
317
318 int ref_frame_flags; 316 int ref_frame_flags;
319 317
320 SPEED_FEATURES sf; 318 SPEED_FEATURES sf;
321 319
322 unsigned int max_mv_magnitude; 320 unsigned int max_mv_magnitude;
323 int mv_step_param; 321 int mv_step_param;
324 322
325 // Default value is 1. From first pass stats, encode_breakout may be disabled. 323 // Default value is 1. From first pass stats, encode_breakout may be disabled.
326 ENCODE_BREAKOUT_TYPE allow_encode_breakout; 324 ENCODE_BREAKOUT_TYPE allow_encode_breakout;
327 325
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 421
424 PICK_MODE_CONTEXT *leaf_tree; 422 PICK_MODE_CONTEXT *leaf_tree;
425 PC_TREE *pc_tree; 423 PC_TREE *pc_tree;
426 PC_TREE *pc_root; 424 PC_TREE *pc_root;
427 int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; 425 int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
428 426
429 int multi_arf_allowed; 427 int multi_arf_allowed;
430 int multi_arf_enabled; 428 int multi_arf_enabled;
431 int multi_arf_last_grp_enabled; 429 int multi_arf_last_grp_enabled;
432 430
433 #if CONFIG_DENOISING 431 #if CONFIG_VP9_TEMPORAL_DENOISING
434 VP9_DENOISER denoiser; 432 VP9_DENOISER denoiser;
435 #endif 433 #endif
436 } VP9_COMP; 434 } VP9_COMP;
437 435
438 void vp9_initialize_enc(); 436 void vp9_initialize_enc();
439 437
440 struct VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf); 438 struct VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf);
441 void vp9_remove_compressor(VP9_COMP *cpi); 439 void vp9_remove_compressor(VP9_COMP *cpi);
442 440
443 void vp9_change_config(VP9_COMP *cpi, const VP9EncoderConfig *oxcf); 441 void vp9_change_config(VP9_COMP *cpi, const VP9EncoderConfig *oxcf);
(...skipping 11 matching lines...) Expand all
455 int vp9_get_preview_raw_frame(VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest, 453 int vp9_get_preview_raw_frame(VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest,
456 vp9_ppflags_t *flags); 454 vp9_ppflags_t *flags);
457 455
458 int vp9_use_as_reference(VP9_COMP *cpi, int ref_frame_flags); 456 int vp9_use_as_reference(VP9_COMP *cpi, int ref_frame_flags);
459 457
460 void vp9_update_reference(VP9_COMP *cpi, int ref_frame_flags); 458 void vp9_update_reference(VP9_COMP *cpi, int ref_frame_flags);
461 459
462 int vp9_copy_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag, 460 int vp9_copy_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
463 YV12_BUFFER_CONFIG *sd); 461 YV12_BUFFER_CONFIG *sd);
464 462
465 int vp9_get_reference_enc(VP9_COMP *cpi, int index,
466 YV12_BUFFER_CONFIG **fb);
467
468 int vp9_set_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag, 463 int vp9_set_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
469 YV12_BUFFER_CONFIG *sd); 464 YV12_BUFFER_CONFIG *sd);
470 465
471 int vp9_update_entropy(VP9_COMP *cpi, int update); 466 int vp9_update_entropy(VP9_COMP *cpi, int update);
472 467
473 int vp9_set_active_map(VP9_COMP *cpi, unsigned char *map, int rows, int cols); 468 int vp9_set_active_map(VP9_COMP *cpi, unsigned char *map, int rows, int cols);
474 469
475 int vp9_set_internal_size(VP9_COMP *cpi, 470 int vp9_set_internal_size(VP9_COMP *cpi,
476 VPX_SCALING horiz_mode, VPX_SCALING vert_mode); 471 VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
477 472
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 int64_t vp9_rescale(int64_t val, int64_t num, int denom); 523 int64_t vp9_rescale(int64_t val, int64_t num, int denom);
529 524
530 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv); 525 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv);
531 526
532 YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm, 527 YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm,
533 YV12_BUFFER_CONFIG *unscaled, 528 YV12_BUFFER_CONFIG *unscaled,
534 YV12_BUFFER_CONFIG *scaled); 529 YV12_BUFFER_CONFIG *scaled);
535 530
536 void vp9_apply_encoding_flags(VP9_COMP *cpi, vpx_enc_frame_flags_t flags); 531 void vp9_apply_encoding_flags(VP9_COMP *cpi, vpx_enc_frame_flags_t flags);
537 532
533 static INLINE int is_spatial_svc(const struct VP9_COMP *const cpi) {
534 return cpi->use_svc &&
535 cpi->svc.number_temporal_layers == 1 &&
536 cpi->svc.number_spatial_layers > 1;
537 }
538
538 static INLINE int is_altref_enabled(const VP9_COMP *const cpi) { 539 static INLINE int is_altref_enabled(const VP9_COMP *const cpi) {
539 return cpi->oxcf.mode != REALTIME && cpi->oxcf.lag_in_frames > 0 && 540 return cpi->oxcf.mode != REALTIME && cpi->oxcf.lag_in_frames > 0 &&
540 (cpi->oxcf.play_alternate && 541 (cpi->oxcf.play_alternate &&
541 (!(cpi->use_svc && cpi->svc.number_temporal_layers == 1) || 542 (!is_spatial_svc(cpi) ||
542 cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id])); 543 cpi->oxcf.ss_play_alternate[cpi->svc.spatial_layer_id]));
543 } 544 }
544 545
545 static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd, 546 static INLINE void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd,
546 MV_REFERENCE_FRAME ref0, 547 MV_REFERENCE_FRAME ref0,
547 MV_REFERENCE_FRAME ref1) { 548 MV_REFERENCE_FRAME ref1) {
548 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME 549 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME
549 : 0]; 550 : 0];
550 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME 551 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME
551 : 0]; 552 : 0];
552 } 553 }
553 554
554 static INLINE int get_chessboard_index(const VP9_COMMON *cm) { 555 static INLINE int get_chessboard_index(const int frame_index) {
555 return cm->current_video_frame % 2; 556 return frame_index & 0x1;
556 } 557 }
557 558
558 #ifdef __cplusplus 559 #ifdef __cplusplus
559 } // extern "C" 560 } // extern "C"
560 #endif 561 #endif
561 562
562 #endif // VP9_ENCODER_VP9_ENCODER_H_ 563 #endif // VP9_ENCODER_VP9_ENCODER_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_encodemb.c ('k') | source/libvpx/vp9/encoder/vp9_encoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698