1 /*
2 * Copyright (c) 2016, 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 AV1_ENCODER_BITSTREAM_H_
13 #define AV1_ENCODER_BITSTREAM_H_
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 #include "av1/encoder/encoder.h"
20
21 struct aom_write_bit_buffer;
22
23 #if CONFIG_REFERENCE_BUFFER
24 void write_sequence_header(AV1_COMMON *const cm,
25 struct aom_write_bit_buffer *wb);
26 #endif
27
28 void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dest, size_t *size);
29
30 void av1_encode_token_init(void);
31
av1_preserve_existing_gf(AV1_COMP * cpi)32 static INLINE int av1_preserve_existing_gf(AV1_COMP *cpi) {
33 #if CONFIG_EXT_REFS
34 // Do not swap gf and arf indices for internal overlay frames
35 return !cpi->multi_arf_allowed && cpi->rc.is_src_frame_alt_ref &&
36 !cpi->rc.is_src_frame_ext_arf;
37 #else
38 return !cpi->multi_arf_allowed && cpi->refresh_golden_frame &&
39 cpi->rc.is_src_frame_alt_ref;
40 #endif // CONFIG_EXT_REFS
41 }
42
43 void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
44 #if CONFIG_SUPERTX
45 const int supertx_enabled,
46 #endif
47 #if CONFIG_TXK_SEL
48 int blk_row, int blk_col, int block, int plane,
49 TX_SIZE tx_size,
50 #endif
51 aom_writer *w);
52
53 #ifdef __cplusplus
54 } // extern "C"
55 #endif
56
57 #endif // AV1_ENCODER_BITSTREAM_H_
58