Home | History | Annotate | Download | only in encoder
      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 VP9_ENCODER_VP9_BITSTREAM_H_
     12 #define 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   int 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 *size);
     39 
     40 static INLINE int vp9_preserve_existing_gf(VP9_COMP *cpi) {
     41   return !cpi->multi_arf_allowed && cpi->refresh_golden_frame &&
     42          cpi->rc.is_src_frame_alt_ref &&
     43          (!cpi->use_svc ||  // Add spatial svc base layer case here
     44           (is_two_pass_svc(cpi) && cpi->svc.spatial_layer_id == 0 &&
     45            cpi->svc.layer_context[0].gold_ref_idx >= 0 &&
     46            cpi->oxcf.ss_enable_auto_arf[0]));
     47 }
     48 
     49 #ifdef __cplusplus
     50 }  // extern "C"
     51 #endif
     52 
     53 #endif  // VP9_ENCODER_VP9_BITSTREAM_H_
     54