| 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" | |
| 18 #include "vpx/internal/vpx_codec_internal.h" | 17 #include "vpx/internal/vpx_codec_internal.h" |
| 19 #include "vpx/vp8cx.h" | 18 #include "vpx/vp8cx.h" |
| 20 | 19 |
| 21 #include "vp9/common/vp9_ppflags.h" | 20 #include "vp9/common/vp9_ppflags.h" |
| 22 #include "vp9/common/vp9_entropy.h" | |
| 23 #include "vp9/common/vp9_entropymode.h" | 21 #include "vp9/common/vp9_entropymode.h" |
| 24 #include "vp9/common/vp9_onyxc_int.h" | 22 #include "vp9/common/vp9_onyxc_int.h" |
| 25 | 23 |
| 26 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" | 24 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" |
| 27 #include "vp9/encoder/vp9_context_tree.h" | 25 #include "vp9/encoder/vp9_context_tree.h" |
| 28 #include "vp9/encoder/vp9_encodemb.h" | 26 #include "vp9/encoder/vp9_encodemb.h" |
| 29 #include "vp9/encoder/vp9_firstpass.h" | 27 #include "vp9/encoder/vp9_firstpass.h" |
| 30 #include "vp9/encoder/vp9_lookahead.h" | 28 #include "vp9/encoder/vp9_lookahead.h" |
| 31 #include "vp9/encoder/vp9_mbgraph.h" | 29 #include "vp9/encoder/vp9_mbgraph.h" |
| 32 #include "vp9/encoder/vp9_mcomp.h" | 30 #include "vp9/encoder/vp9_mcomp.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 struct lookahead_ctx *lookahead; | 232 struct lookahead_ctx *lookahead; |
| 235 struct lookahead_entry *alt_ref_source; | 233 struct lookahead_entry *alt_ref_source; |
| 236 | 234 |
| 237 YV12_BUFFER_CONFIG *Source; | 235 YV12_BUFFER_CONFIG *Source; |
| 238 YV12_BUFFER_CONFIG *Last_Source; // NULL for first frame and alt_ref frames | 236 YV12_BUFFER_CONFIG *Last_Source; // NULL for first frame and alt_ref frames |
| 239 YV12_BUFFER_CONFIG *un_scaled_source; | 237 YV12_BUFFER_CONFIG *un_scaled_source; |
| 240 YV12_BUFFER_CONFIG scaled_source; | 238 YV12_BUFFER_CONFIG scaled_source; |
| 241 YV12_BUFFER_CONFIG *unscaled_last_source; | 239 YV12_BUFFER_CONFIG *unscaled_last_source; |
| 242 YV12_BUFFER_CONFIG scaled_last_source; | 240 YV12_BUFFER_CONFIG scaled_last_source; |
| 243 | 241 |
| 244 int skippable_frame; | 242 // For a still frame, this flag is set to 1 to skip partition search. |
| 243 int partition_search_skippable_frame; |
| 245 | 244 |
| 246 int scaled_ref_idx[3]; | 245 int scaled_ref_idx[3]; |
| 247 int lst_fb_idx; | 246 int lst_fb_idx; |
| 248 int gld_fb_idx; | 247 int gld_fb_idx; |
| 249 int alt_fb_idx; | 248 int alt_fb_idx; |
| 250 | 249 |
| 251 int refresh_last_frame; | 250 int refresh_last_frame; |
| 252 int refresh_golden_frame; | 251 int refresh_golden_frame; |
| 253 int refresh_alt_ref_frame; | 252 int refresh_alt_ref_frame; |
| 254 | 253 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 474 |
| 476 static INLINE int get_token_alloc(int mb_rows, int mb_cols) { | 475 static INLINE int get_token_alloc(int mb_rows, int mb_cols) { |
| 477 // TODO(JBB): double check we can't exceed this token count if we have a | 476 // TODO(JBB): double check we can't exceed this token count if we have a |
| 478 // 32x32 transform crossing a boundary at a multiple of 16. | 477 // 32x32 transform crossing a boundary at a multiple of 16. |
| 479 // mb_rows, cols are in units of 16 pixels. We assume 3 planes all at full | 478 // mb_rows, cols are in units of 16 pixels. We assume 3 planes all at full |
| 480 // resolution. We assume up to 1 token per pixel, and then allow | 479 // resolution. We assume up to 1 token per pixel, and then allow |
| 481 // a head room of 4. | 480 // a head room of 4. |
| 482 return mb_rows * mb_cols * (16 * 16 * 3 + 4); | 481 return mb_rows * mb_cols * (16 * 16 * 3 + 4); |
| 483 } | 482 } |
| 484 | 483 |
| 484 // Get the allocated token size for a tile. It does the same calculation as in |
| 485 // the frame token allocation. |
| 486 static INLINE int allocated_tokens(TileInfo tile) { |
| 487 int tile_mb_rows = (tile.mi_row_end - tile.mi_row_start + 1) >> 1; |
| 488 int tile_mb_cols = (tile.mi_col_end - tile.mi_col_start + 1) >> 1; |
| 489 |
| 490 return get_token_alloc(tile_mb_rows, tile_mb_cols); |
| 491 } |
| 492 |
| 485 int vp9_get_y_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b); | 493 int vp9_get_y_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b); |
| 494 #if CONFIG_VP9_HIGHBITDEPTH |
| 495 int vp9_highbd_get_y_sse(const YV12_BUFFER_CONFIG *a, |
| 496 const YV12_BUFFER_CONFIG *b, |
| 497 vpx_bit_depth_t bit_depth); |
| 498 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 486 | 499 |
| 487 void vp9_alloc_compressor_data(VP9_COMP *cpi); | 500 void vp9_alloc_compressor_data(VP9_COMP *cpi); |
| 488 | 501 |
| 489 void vp9_scale_references(VP9_COMP *cpi); | 502 void vp9_scale_references(VP9_COMP *cpi); |
| 490 | 503 |
| 491 void vp9_update_reference_frames(VP9_COMP *cpi); | 504 void vp9_update_reference_frames(VP9_COMP *cpi); |
| 492 | 505 |
| 493 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv); | 506 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv); |
| 494 | 507 |
| 495 YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm, | 508 YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 518 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME | 531 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME |
| 519 : 0]; | 532 : 0]; |
| 520 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME | 533 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME |
| 521 : 0]; | 534 : 0]; |
| 522 } | 535 } |
| 523 | 536 |
| 524 static INLINE int get_chessboard_index(const int frame_index) { | 537 static INLINE int get_chessboard_index(const int frame_index) { |
| 525 return frame_index & 0x1; | 538 return frame_index & 0x1; |
| 526 } | 539 } |
| 527 | 540 |
| 528 static INLINE int *cond_sad_list(const struct VP9_COMP *cpi, int *sad_list) { | 541 static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) { |
| 529 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? sad_list : NULL; | 542 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; |
| 530 } | 543 } |
| 531 | 544 |
| 532 #ifdef __cplusplus | 545 #ifdef __cplusplus |
| 533 } // extern "C" | 546 } // extern "C" |
| 534 #endif | 547 #endif |
| 535 | 548 |
| 536 #endif // VP9_ENCODER_VP9_ENCODER_H_ | 549 #endif // VP9_ENCODER_VP9_ENCODER_H_ |
| OLD | NEW |