media/libvpx/vp9/common/vp9_onyx.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp9/common/vp9_onyx.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,239 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +#ifndef VP9_COMMON_VP9_ONYX_H_
    1.15 +#define VP9_COMMON_VP9_ONYX_H_
    1.16 +
    1.17 +#ifdef __cplusplus
    1.18 +extern "C"
    1.19 +{ // NOLINT
    1.20 +#endif
    1.21 +
    1.22 +#include "./vpx_config.h"
    1.23 +#include "vpx/internal/vpx_codec_internal.h"
    1.24 +#include "vpx/vp8cx.h"
    1.25 +#include "vpx_scale/yv12config.h"
    1.26 +#include "vp9/common/vp9_ppflags.h"
    1.27 +
    1.28 +#define MAX_SEGMENTS 8
    1.29 +
    1.30 +  typedef int *VP9_PTR;
    1.31 +
    1.32 +  /* Create/destroy static data structures. */
    1.33 +
    1.34 +  typedef enum {
    1.35 +    NORMAL      = 0,
    1.36 +    FOURFIVE    = 1,
    1.37 +    THREEFIVE   = 2,
    1.38 +    ONETWO      = 3
    1.39 +  } VPX_SCALING;
    1.40 +
    1.41 +  typedef enum {
    1.42 +    VP9_LAST_FLAG = 1,
    1.43 +    VP9_GOLD_FLAG = 2,
    1.44 +    VP9_ALT_FLAG = 4
    1.45 +  } VP9_REFFRAME;
    1.46 +
    1.47 +
    1.48 +  typedef enum {
    1.49 +    USAGE_STREAM_FROM_SERVER    = 0x0,
    1.50 +    USAGE_LOCAL_FILE_PLAYBACK   = 0x1,
    1.51 +    USAGE_CONSTRAINED_QUALITY   = 0x2,
    1.52 +    USAGE_CONSTANT_QUALITY      = 0x3,
    1.53 +  } END_USAGE;
    1.54 +
    1.55 +
    1.56 +  typedef enum {
    1.57 +    MODE_GOODQUALITY    = 0x1,
    1.58 +    MODE_BESTQUALITY    = 0x2,
    1.59 +    MODE_FIRSTPASS      = 0x3,
    1.60 +    MODE_SECONDPASS     = 0x4,
    1.61 +    MODE_SECONDPASS_BEST = 0x5,
    1.62 +  } MODE;
    1.63 +
    1.64 +  typedef enum {
    1.65 +    FRAMEFLAGS_KEY    = 1,
    1.66 +    FRAMEFLAGS_GOLDEN = 2,
    1.67 +    FRAMEFLAGS_ALTREF = 4,
    1.68 +  } FRAMETYPE_FLAGS;
    1.69 +
    1.70 +  typedef enum {
    1.71 +    NO_AQ = 0,
    1.72 +    VARIANCE_AQ = 1,
    1.73 +    AQ_MODES_COUNT  // This should always be the last member of the enum
    1.74 +  } AQ_MODES;
    1.75 +
    1.76 +  typedef struct {
    1.77 +    int version;  // 4 versions of bitstream defined:
    1.78 +                  //   0 - best quality/slowest decode,
    1.79 +                  //   3 - lowest quality/fastest decode
    1.80 +    int width;  // width of data passed to the compressor
    1.81 +    int height;  // height of data passed to the compressor
    1.82 +    double framerate;  // set to passed in framerate
    1.83 +    int64_t target_bandwidth;  // bandwidth to be used in kilobits per second
    1.84 +
    1.85 +    int noise_sensitivity;  // pre processing blur: recommendation 0
    1.86 +    int Sharpness;  // sharpening output: recommendation 0:
    1.87 +    int cpu_used;
    1.88 +    unsigned int rc_max_intra_bitrate_pct;
    1.89 +
    1.90 +    // mode ->
    1.91 +    // (0)=Realtime/Live Encoding. This mode is optimized for realtime
    1.92 +    //     encoding (for example, capturing a television signal or feed from
    1.93 +    //     a live camera). ( speed setting controls how fast )
    1.94 +    // (1)=Good Quality Fast Encoding. The encoder balances quality with the
    1.95 +    //     amount of time it takes to encode the output. ( speed setting
    1.96 +    //     controls how fast )
    1.97 +    // (2)=One Pass - Best Quality. The encoder places priority on the
    1.98 +    //     quality of the output over encoding speed. The output is compressed
    1.99 +    //     at the highest possible quality. This option takes the longest
   1.100 +    //     amount of time to encode. ( speed setting ignored )
   1.101 +    // (3)=Two Pass - First Pass. The encoder generates a file of statistics
   1.102 +    //     for use in the second encoding pass. ( speed setting controls how
   1.103 +    //     fast )
   1.104 +    // (4)=Two Pass - Second Pass. The encoder uses the statistics that were
   1.105 +    //     generated in the first encoding pass to create the compressed
   1.106 +    //     output. ( speed setting controls how fast )
   1.107 +    // (5)=Two Pass - Second Pass Best.  The encoder uses the statistics that
   1.108 +    //     were generated in the first encoding pass to create the compressed
   1.109 +    //     output using the highest possible quality, and taking a
   1.110 +    //    longer amount of time to encode.. ( speed setting ignored )
   1.111 +    int Mode;
   1.112 +
   1.113 +    // Key Framing Operations
   1.114 +    int auto_key;  // autodetect cut scenes and set the keyframes
   1.115 +    int key_freq;  // maximum distance to key frame.
   1.116 +
   1.117 +    int allow_lag;  // allow lagged compression (if 0 lagin frames is ignored)
   1.118 +    int lag_in_frames;  // how many frames lag before we start encoding
   1.119 +
   1.120 +    // ----------------------------------------------------------------
   1.121 +    // DATARATE CONTROL OPTIONS
   1.122 +
   1.123 +    int end_usage;  // vbr or cbr
   1.124 +
   1.125 +    // buffer targeting aggressiveness
   1.126 +    int under_shoot_pct;
   1.127 +    int over_shoot_pct;
   1.128 +
   1.129 +    // buffering parameters
   1.130 +    int64_t starting_buffer_level;  // in seconds
   1.131 +    int64_t optimal_buffer_level;
   1.132 +    int64_t maximum_buffer_size;
   1.133 +
   1.134 +    // controlling quality
   1.135 +    int fixed_q;
   1.136 +    int worst_allowed_q;
   1.137 +    int best_allowed_q;
   1.138 +    int cq_level;
   1.139 +    int lossless;
   1.140 +    int aq_mode;  // Adaptive Quantization mode
   1.141 +
   1.142 +    // two pass datarate control
   1.143 +    int two_pass_vbrbias;        // two pass datarate control tweaks
   1.144 +    int two_pass_vbrmin_section;
   1.145 +    int two_pass_vbrmax_section;
   1.146 +    // END DATARATE CONTROL OPTIONS
   1.147 +    // ----------------------------------------------------------------
   1.148 +
   1.149 +    // Spatial scalability
   1.150 +    int ss_number_layers;
   1.151 +
   1.152 +    // these parameters aren't to be used in final build don't use!!!
   1.153 +    int play_alternate;
   1.154 +    int alt_freq;
   1.155 +
   1.156 +    int encode_breakout;  // early breakout : for video conf recommend 800
   1.157 +
   1.158 +    /* Bitfield defining the error resiliency features to enable.
   1.159 +     * Can provide decodable frames after losses in previous
   1.160 +     * frames and decodable partitions after losses in the same frame.
   1.161 +     */
   1.162 +    unsigned int error_resilient_mode;
   1.163 +
   1.164 +    /* Bitfield defining the parallel decoding mode where the
   1.165 +     * decoding in successive frames may be conducted in parallel
   1.166 +     * just by decoding the frame headers.
   1.167 +     */
   1.168 +    unsigned int frame_parallel_decoding_mode;
   1.169 +
   1.170 +    int arnr_max_frames;
   1.171 +    int arnr_strength;
   1.172 +    int arnr_type;
   1.173 +
   1.174 +    int tile_columns;
   1.175 +    int tile_rows;
   1.176 +
   1.177 +    struct vpx_fixed_buf         two_pass_stats_in;
   1.178 +    struct vpx_codec_pkt_list  *output_pkt_list;
   1.179 +
   1.180 +    vp8e_tuning tuning;
   1.181 +  } VP9_CONFIG;
   1.182 +
   1.183 +
   1.184 +  void vp9_initialize_enc();
   1.185 +
   1.186 +  VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf);
   1.187 +  void vp9_remove_compressor(VP9_PTR *comp);
   1.188 +
   1.189 +  void vp9_change_config(VP9_PTR onyx, VP9_CONFIG *oxcf);
   1.190 +
   1.191 +  // receive a frames worth of data. caller can assume that a copy of this
   1.192 +  // frame is made and not just a copy of the pointer..
   1.193 +  int vp9_receive_raw_frame(VP9_PTR comp, unsigned int frame_flags,
   1.194 +                            YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
   1.195 +                            int64_t end_time_stamp);
   1.196 +
   1.197 +  int vp9_get_compressed_data(VP9_PTR comp, unsigned int *frame_flags,
   1.198 +                              unsigned long *size, unsigned char *dest,
   1.199 +                              int64_t *time_stamp, int64_t *time_end,
   1.200 +                              int flush);
   1.201 +
   1.202 +  int vp9_get_preview_raw_frame(VP9_PTR comp, YV12_BUFFER_CONFIG *dest,
   1.203 +                                vp9_ppflags_t *flags);
   1.204 +
   1.205 +  int vp9_use_as_reference(VP9_PTR comp, int ref_frame_flags);
   1.206 +
   1.207 +  int vp9_update_reference(VP9_PTR comp, int ref_frame_flags);
   1.208 +
   1.209 +  int vp9_copy_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
   1.210 +                             YV12_BUFFER_CONFIG *sd);
   1.211 +
   1.212 +  int vp9_get_reference_enc(VP9_PTR ptr, int index, YV12_BUFFER_CONFIG **fb);
   1.213 +
   1.214 +  int vp9_set_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
   1.215 +                            YV12_BUFFER_CONFIG *sd);
   1.216 +
   1.217 +  int vp9_update_entropy(VP9_PTR comp, int update);
   1.218 +
   1.219 +  int vp9_set_roimap(VP9_PTR comp, unsigned char *map,
   1.220 +                     unsigned int rows, unsigned int cols,
   1.221 +                     int delta_q[MAX_SEGMENTS],
   1.222 +                     int delta_lf[MAX_SEGMENTS],
   1.223 +                     unsigned int threshold[MAX_SEGMENTS]);
   1.224 +
   1.225 +  int vp9_set_active_map(VP9_PTR comp, unsigned char *map,
   1.226 +                         unsigned int rows, unsigned int cols);
   1.227 +
   1.228 +  int vp9_set_internal_size(VP9_PTR comp,
   1.229 +                            VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
   1.230 +
   1.231 +  int vp9_set_size_literal(VP9_PTR comp, unsigned int width,
   1.232 +                           unsigned int height);
   1.233 +
   1.234 +  void vp9_set_svc(VP9_PTR comp, int use_svc);
   1.235 +
   1.236 +  int vp9_get_quantizer(VP9_PTR c);
   1.237 +
   1.238 +#ifdef __cplusplus
   1.239 +}
   1.240 +#endif
   1.241 +
   1.242 +#endif  // VP9_COMMON_VP9_ONYX_H_

mercurial