1 /* 2 * Copyright (c) 2019, Alliance for Open Media. All rights reserved 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10 */ 11 12 #ifndef AOM_AV1_ENCODER_ENCODE_STRATEGY_H_ 13 #define AOM_AV1_ENCODER_ENCODE_STRATEGY_H_ 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 #include <stdint.h> 20 21 #include "aom/aom_encoder.h" 22 23 #include "av1/encoder/encoder.h" 24 #include "av1/encoder/firstpass.h" 25 26 // This function will implement high-level encode strategy, choosing frame type, 27 // frame placement, etc. It populates an EncodeFrameParams struct with the 28 // results of these decisions and then calls av1_encode() 29 int av1_encode_strategy(AV1_COMP *const cpi, size_t *const size, 30 uint8_t *const dest, unsigned int *frame_flags, 31 int64_t *const time_stamp, int64_t *const time_end, 32 const aom_rational64_t *const timestamp_ratio, 33 int flush); 34 35 // Set individual buffer update flags based on frame reference type. 36 // force_refresh_all is used when we have a KEY_FRAME or S_FRAME. It forces all 37 // refresh_*_frame flags to be set, because we refresh all buffers in this case. 38 void av1_configure_buffer_updates(AV1_COMP *const cpi, 39 EncodeFrameParams *const frame_params, 40 const FRAME_UPDATE_TYPE type, 41 int force_refresh_all); 42 43 int av1_get_refresh_frame_flags(const AV1_COMP *const cpi, 44 const EncodeFrameParams *const frame_params, 45 FRAME_UPDATE_TYPE frame_update_type, 46 const RefBufferStack *const ref_buffer_stack); 47 48 int av1_get_refresh_ref_frame_map(int refresh_frame_flags); 49 50 void av1_update_ref_frame_map(AV1_COMP *cpi, 51 FRAME_UPDATE_TYPE frame_update_type, 52 int show_existing_frame, int ref_map_index, 53 RefBufferStack *ref_buffer_stack); 54 55 void av1_get_ref_frames(AV1_COMP *const cpi, RefBufferStack *ref_buffer_stack); 56 57 int is_forced_keyframe_pending(struct lookahead_ctx *lookahead, 58 const int up_to_index, 59 const COMPRESSOR_STAGE compressor_stage); 60 #ifdef __cplusplus 61 } // extern "C" 62 #endif 63 64 #endif // AOM_AV1_ENCODER_ENCODE_STRATEGY_H_ 65