xref: /aosp_15_r20/external/libvpx/vp9/encoder/vp9_bitstream.h (revision fb1b10ab9aebc7c7068eedab379b749d7e3900be)
1 /*
2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef VPX_VP9_ENCODER_VP9_BITSTREAM_H_
12 #define VPX_VP9_ENCODER_VP9_BITSTREAM_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include "vp9/encoder/vp9_encoder.h"
19 
20 typedef struct VP9BitstreamWorkerData {
21   uint8_t *dest;
22   size_t dest_size;
23   vpx_writer bit_writer;
24   int tile_idx;
25   unsigned int max_mv_magnitude;
26   // The size of interp_filter_selected in VP9_COMP is actually
27   // MAX_REFERENCE_FRAMES x SWITCHABLE. But when encoding tiles, all we ever do
28   // is increment the very first index (index 0) for the first dimension. Hence
29   // this is sufficient.
30   int interp_filter_selected[1][SWITCHABLE];
31   DECLARE_ALIGNED(16, MACROBLOCKD, xd);
32 } VP9BitstreamWorkerData;
33 
34 int vp9_get_refresh_mask(VP9_COMP *cpi);
35 
36 void vp9_bitstream_encode_tiles_buffer_dealloc(VP9_COMP *const cpi);
37 
38 void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t dest_size,
39                         size_t *size);
40 
vp9_preserve_existing_gf(VP9_COMP * cpi)41 static INLINE int vp9_preserve_existing_gf(VP9_COMP *cpi) {
42   return cpi->refresh_golden_frame && cpi->rc.is_src_frame_alt_ref &&
43          !cpi->use_svc;
44 }
45 
46 #ifdef __cplusplus
47 }  // extern "C"
48 #endif
49 
50 #endif  // VPX_VP9_ENCODER_VP9_BITSTREAM_H_
51