aboutsummaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_ext_ratectrl.h
blob: 7c3875883352dab0cdac06f72028a5dedb177fe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 *  Copyright (c) 2020 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_
#define VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_

#include "vpx/vpx_ext_ratectrl.h"
#include "vp9/encoder/vp9_firstpass.h"

typedef struct EXT_RATECTRL {
  int ready;
  int ext_rdmult;
  vpx_rc_model_t model;
  vpx_rc_funcs_t funcs;
  vpx_rc_config_t ratectrl_config;
  vpx_rc_firstpass_stats_t rc_firstpass_stats;
} EXT_RATECTRL;

vpx_codec_err_t vp9_extrc_init(EXT_RATECTRL *ext_ratectrl);

vpx_codec_err_t vp9_extrc_create(vpx_rc_funcs_t funcs,
                                 vpx_rc_config_t ratectrl_config,
                                 EXT_RATECTRL *ext_ratectrl);

vpx_codec_err_t vp9_extrc_delete(EXT_RATECTRL *ext_ratectrl);

vpx_codec_err_t vp9_extrc_send_firstpass_stats(
    EXT_RATECTRL *ext_ratectrl, const FIRST_PASS_INFO *first_pass_info);

vpx_codec_err_t vp9_extrc_get_encodeframe_decision(
    EXT_RATECTRL *ext_ratectrl, int show_index, int coding_index, int gop_index,
    FRAME_UPDATE_TYPE update_type, int gop_size, int use_alt_ref,
    RefCntBuffer *ref_frame_bufs[MAX_INTER_REF_FRAMES], int ref_frame_flags,
    vpx_rc_encodeframe_decision_t *encode_frame_decision);

vpx_codec_err_t vp9_extrc_update_encodeframe_result(
    EXT_RATECTRL *ext_ratectrl, int64_t bit_count,
    const YV12_BUFFER_CONFIG *source_frame,
    const YV12_BUFFER_CONFIG *coded_frame, uint32_t bit_depth,
    uint32_t input_bit_depth, const int actual_encoding_qindex);

vpx_codec_err_t vp9_extrc_get_gop_decision(
    EXT_RATECTRL *ext_ratectrl, const vpx_rc_gop_info_t *const gop_info,
    vpx_rc_gop_decision_t *gop_decision);

vpx_codec_err_t vp9_extrc_get_frame_rdmult(
    EXT_RATECTRL *ext_ratectrl, int show_index, int coding_index, int gop_index,
    FRAME_UPDATE_TYPE update_type, int gop_size, int use_alt_ref,
    RefCntBuffer *ref_frame_bufs[MAX_INTER_REF_FRAMES], int ref_frame_flags,
    int *rdmult);

#endif  // VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_