Commit 3f1ab258 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Removing vp9_onyx.h and moving its content to the encoder.

Change-Id: I03451c88536bc498edddbe0cd9773ff79da085c2
parent 7a7db0f0
/*
* Copyright (c) 2010 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 VP9_COMMON_VP9_ONYX_H_
#define VP9_COMMON_VP9_ONYX_H_
#include "./vpx_config.h"
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx/vp8cx.h"
#include "vpx_scale/yv12config.h"
#include "vp9/common/vp9_ppflags.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_SEGMENTS 8
struct VP9_COMP;
/* Create/destroy static data structures. */
typedef enum {
NORMAL = 0,
FOURFIVE = 1,
THREEFIVE = 2,
ONETWO = 3
} VPX_SCALING;
typedef enum {
VP9_LAST_FLAG = 1,
VP9_GOLD_FLAG = 2,
VP9_ALT_FLAG = 4
} VP9_REFFRAME;
typedef enum {
USAGE_LOCAL_FILE_PLAYBACK = 0x0,
USAGE_STREAM_FROM_SERVER = 0x1,
USAGE_CONSTRAINED_QUALITY = 0x2,
USAGE_CONSTANT_QUALITY = 0x3,
} END_USAGE;
typedef enum {
MODE_GOODQUALITY = 0x1,
MODE_BESTQUALITY = 0x2,
MODE_FIRSTPASS = 0x3,
MODE_SECONDPASS = 0x4,
MODE_SECONDPASS_BEST = 0x5,
MODE_REALTIME = 0x6,
} MODE;
typedef enum {
FRAMEFLAGS_KEY = 1,
FRAMEFLAGS_GOLDEN = 2,
FRAMEFLAGS_ALTREF = 4,
} FRAMETYPE_FLAGS;
typedef enum {
NO_AQ = 0,
VARIANCE_AQ = 1,
COMPLEXITY_AQ = 2,
AQ_MODES_COUNT // This should always be the last member of the enum
} AQ_MODES;
typedef struct {
int version; // 4 versions of bitstream defined:
// 0 - best quality/slowest decode,
// 3 - lowest quality/fastest decode
int width; // width of data passed to the compressor
int height; // height of data passed to the compressor
double framerate; // set to passed in framerate
int64_t target_bandwidth; // bandwidth to be used in kilobits per second
int noise_sensitivity; // pre processing blur: recommendation 0
int sharpness; // sharpening output: recommendation 0:
int cpu_used;
unsigned int rc_max_intra_bitrate_pct;
// mode ->
// (0)=Realtime/Live Encoding. This mode is optimized for realtime
// encoding (for example, capturing a television signal or feed from
// a live camera). ( speed setting controls how fast )
// (1)=Good Quality Fast Encoding. The encoder balances quality with the
// amount of time it takes to encode the output. ( speed setting
// controls how fast )
// (2)=One Pass - Best Quality. The encoder places priority on the
// quality of the output over encoding speed. The output is compressed
// at the highest possible quality. This option takes the longest
// amount of time to encode. ( speed setting ignored )
// (3)=Two Pass - First Pass. The encoder generates a file of statistics
// for use in the second encoding pass. ( speed setting controls how
// fast )
// (4)=Two Pass - Second Pass. The encoder uses the statistics that were
// generated in the first encoding pass to create the compressed
// output. ( speed setting controls how fast )
// (5)=Two Pass - Second Pass Best. The encoder uses the statistics that
// were generated in the first encoding pass to create the compressed
// output using the highest possible quality, and taking a
// longer amount of time to encode.. ( speed setting ignored )
int mode;
// Key Framing Operations
int auto_key; // autodetect cut scenes and set the keyframes
int key_freq; // maximum distance to key frame.
int lag_in_frames; // how many frames lag before we start encoding
// ----------------------------------------------------------------
// DATARATE CONTROL OPTIONS
int end_usage; // vbr or cbr
// buffer targeting aggressiveness
int under_shoot_pct;
int over_shoot_pct;
// buffering parameters
int64_t starting_buffer_level; // in seconds
int64_t optimal_buffer_level;
int64_t maximum_buffer_size;
// Frame drop threshold.
int drop_frames_water_mark;
// controlling quality
int fixed_q;
int worst_allowed_q;
int best_allowed_q;
int cq_level;
int lossless;
int aq_mode; // Adaptive Quantization mode
// two pass datarate control
int two_pass_vbrbias; // two pass datarate control tweaks
int two_pass_vbrmin_section;
int two_pass_vbrmax_section;
// END DATARATE CONTROL OPTIONS
// ----------------------------------------------------------------
// Spatial and temporal scalability.
int ss_number_layers; // Number of spatial layers.
int ts_number_layers; // Number of temporal layers.
// Bitrate allocation for spatial layers.
int ss_target_bitrate[VPX_SS_MAX_LAYERS];
// Bitrate allocation (CBR mode) and framerate factor, for temporal layers.
int ts_target_bitrate[VPX_TS_MAX_LAYERS];
int ts_rate_decimator[VPX_TS_MAX_LAYERS];
// these parameters aren't to be used in final build don't use!!!
int play_alternate;
int alt_freq;
int encode_breakout; // early breakout : for video conf recommend 800
/* Bitfield defining the error resiliency features to enable.
* Can provide decodable frames after losses in previous
* frames and decodable partitions after losses in the same frame.
*/
unsigned int error_resilient_mode;
/* Bitfield defining the parallel decoding mode where the
* decoding in successive frames may be conducted in parallel
* just by decoding the frame headers.
*/
unsigned int frame_parallel_decoding_mode;
int arnr_max_frames;
int arnr_strength;
int arnr_type;
int tile_columns;
int tile_rows;
struct vpx_fixed_buf two_pass_stats_in;
struct vpx_codec_pkt_list *output_pkt_list;
vp8e_tuning tuning;
} VP9_CONFIG;
void vp9_initialize_enc();
struct VP9_COMP *vp9_create_compressor(VP9_CONFIG *oxcf);
void vp9_remove_compressor(struct VP9_COMP *cpi);
void vp9_change_config(struct VP9_COMP *cpi, VP9_CONFIG *oxcf);
// receive a frames worth of data. caller can assume that a copy of this
// frame is made and not just a copy of the pointer..
int vp9_receive_raw_frame(struct VP9_COMP *cpi, unsigned int frame_flags,
YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
int64_t end_time_stamp);
int vp9_get_compressed_data(struct VP9_COMP *cpi, unsigned int *frame_flags,
size_t *size, uint8_t *dest,
int64_t *time_stamp, int64_t *time_end, int flush);
int vp9_get_preview_raw_frame(struct VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest,
vp9_ppflags_t *flags);
int vp9_use_as_reference(struct VP9_COMP *cpi, int ref_frame_flags);
int vp9_update_reference(struct VP9_COMP *cpi, int ref_frame_flags);
int vp9_copy_reference_enc(struct VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
int vp9_get_reference_enc(struct VP9_COMP *cpi, int index,
YV12_BUFFER_CONFIG **fb);
int vp9_set_reference_enc(struct VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
int vp9_update_entropy(struct VP9_COMP *cpi, int update);
int vp9_set_roimap(struct VP9_COMP *cpi, unsigned char *map,
unsigned int rows, unsigned int cols,
int delta_q[MAX_SEGMENTS],
int delta_lf[MAX_SEGMENTS],
unsigned int threshold[MAX_SEGMENTS]);
int vp9_set_active_map(struct VP9_COMP *cpi, unsigned char *map,
unsigned int rows, unsigned int cols);
int vp9_set_internal_size(struct VP9_COMP *cpi,
VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
int vp9_set_size_literal(struct VP9_COMP *cpi, unsigned int width,
unsigned int height);
void vp9_set_svc(struct VP9_COMP *cpi, int use_svc);
int vp9_get_quantizer(struct VP9_COMP *cpi);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // VP9_COMMON_VP9_ONYX_H_
......@@ -11,7 +11,6 @@
#ifndef VP9_ENCODER_VP9_BLOCK_H_
#define VP9_ENCODER_VP9_BLOCK_H_
#include "vp9/common/vp9_onyx.h"
#include "vp9/common/vp9_entropymv.h"
#include "vp9/common/vp9_entropy.h"
#include "vpx_ports/mem.h"
......
......@@ -16,10 +16,11 @@
#include "./vpx_config.h"
#include "vpx_ports/mem.h"
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx/vp8cx.h"
#include "vp9/common/vp9_ppflags.h"
#include "vp9/common/vp9_entropy.h"
#include "vp9/common/vp9_entropymode.h"
#include "vp9/common/vp9_onyx.h"
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/encoder/vp9_encodemb.h"
......@@ -440,6 +441,166 @@ typedef struct {
int avg_frame_size;
} LAYER_CONTEXT;
#define MAX_SEGMENTS 8
typedef enum {
NORMAL = 0,
FOURFIVE = 1,
THREEFIVE = 2,
ONETWO = 3
} VPX_SCALING;
typedef enum {
VP9_LAST_FLAG = 1,
VP9_GOLD_FLAG = 2,
VP9_ALT_FLAG = 4
} VP9_REFFRAME;
typedef enum {
USAGE_LOCAL_FILE_PLAYBACK = 0x0,
USAGE_STREAM_FROM_SERVER = 0x1,
USAGE_CONSTRAINED_QUALITY = 0x2,
USAGE_CONSTANT_QUALITY = 0x3,
} END_USAGE;
typedef enum {
MODE_GOODQUALITY = 0x1,
MODE_BESTQUALITY = 0x2,
MODE_FIRSTPASS = 0x3,
MODE_SECONDPASS = 0x4,
MODE_SECONDPASS_BEST = 0x5,
MODE_REALTIME = 0x6,
} MODE;
typedef enum {
FRAMEFLAGS_KEY = 1,
FRAMEFLAGS_GOLDEN = 2,
FRAMEFLAGS_ALTREF = 4,
} FRAMETYPE_FLAGS;
typedef enum {
NO_AQ = 0,
VARIANCE_AQ = 1,
COMPLEXITY_AQ = 2,
AQ_MODES_COUNT // This should always be the last member of the enum
} AQ_MODES;
typedef struct {
int version; // 4 versions of bitstream defined:
// 0 - best quality/slowest decode,
// 3 - lowest quality/fastest decode
int width; // width of data passed to the compressor
int height; // height of data passed to the compressor
double framerate; // set to passed in framerate
int64_t target_bandwidth; // bandwidth to be used in kilobits per second
int noise_sensitivity; // pre processing blur: recommendation 0
int sharpness; // sharpening output: recommendation 0:
int cpu_used;
unsigned int rc_max_intra_bitrate_pct;
// mode ->
// (0)=Realtime/Live Encoding. This mode is optimized for realtime
// encoding (for example, capturing a television signal or feed from
// a live camera). ( speed setting controls how fast )
// (1)=Good Quality Fast Encoding. The encoder balances quality with the
// amount of time it takes to encode the output. ( speed setting
// controls how fast )
// (2)=One Pass - Best Quality. The encoder places priority on the
// quality of the output over encoding speed. The output is compressed
// at the highest possible quality. This option takes the longest
// amount of time to encode. ( speed setting ignored )
// (3)=Two Pass - First Pass. The encoder generates a file of statistics
// for use in the second encoding pass. ( speed setting controls how
// fast )
// (4)=Two Pass - Second Pass. The encoder uses the statistics that were
// generated in the first encoding pass to create the compressed
// output. ( speed setting controls how fast )
// (5)=Two Pass - Second Pass Best. The encoder uses the statistics that
// were generated in the first encoding pass to create the compressed
// output using the highest possible quality, and taking a
// longer amount of time to encode.. ( speed setting ignored )
int mode;
// Key Framing Operations
int auto_key; // autodetect cut scenes and set the keyframes
int key_freq; // maximum distance to key frame.
int lag_in_frames; // how many frames lag before we start encoding
// ----------------------------------------------------------------
// DATARATE CONTROL OPTIONS
int end_usage; // vbr or cbr
// buffer targeting aggressiveness
int under_shoot_pct;
int over_shoot_pct;
// buffering parameters
int64_t starting_buffer_level; // in seconds
int64_t optimal_buffer_level;
int64_t maximum_buffer_size;
// Frame drop threshold.
int drop_frames_water_mark;
// controlling quality
int fixed_q;
int worst_allowed_q;
int best_allowed_q;
int cq_level;
int lossless;
int aq_mode; // Adaptive Quantization mode
// two pass datarate control
int two_pass_vbrbias; // two pass datarate control tweaks
int two_pass_vbrmin_section;
int two_pass_vbrmax_section;
// END DATARATE CONTROL OPTIONS
// ----------------------------------------------------------------
// Spatial and temporal scalability.
int ss_number_layers; // Number of spatial layers.
int ts_number_layers; // Number of temporal layers.
// Bitrate allocation for spatial layers.
int ss_target_bitrate[VPX_SS_MAX_LAYERS];
// Bitrate allocation (CBR mode) and framerate factor, for temporal layers.
int ts_target_bitrate[VPX_TS_MAX_LAYERS];
int ts_rate_decimator[VPX_TS_MAX_LAYERS];
// these parameters aren't to be used in final build don't use!!!
int play_alternate;
int alt_freq;
int encode_breakout; // early breakout : for video conf recommend 800
/* Bitfield defining the error resiliency features to enable.
* Can provide decodable frames after losses in previous
* frames and decodable partitions after losses in the same frame.
*/
unsigned int error_resilient_mode;
/* Bitfield defining the parallel decoding mode where the
* decoding in successive frames may be conducted in parallel
* just by decoding the frame headers.
*/
unsigned int frame_parallel_decoding_mode;
int arnr_max_frames;
int arnr_strength;
int arnr_type;
int tile_columns;
int tile_rows;
struct vpx_fixed_buf two_pass_stats_in;
struct vpx_codec_pkt_list *output_pkt_list;
vp8e_tuning tuning;
} VP9_CONFIG;
typedef struct VP9_COMP {
DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]);
......@@ -706,6 +867,60 @@ typedef struct VP9_COMP {
PARTITION_CONTEXT left_seg_context[8];
} VP9_COMP;
void vp9_initialize_enc();
struct VP9_COMP *vp9_create_compressor(VP9_CONFIG *oxcf);
void vp9_remove_compressor(VP9_COMP *cpi);
void vp9_change_config(VP9_COMP *cpi, VP9_CONFIG *oxcf);
// receive a frames worth of data. caller can assume that a copy of this
// frame is made and not just a copy of the pointer..
int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags,
YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
int64_t end_time_stamp);
int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
size_t *size, uint8_t *dest,
int64_t *time_stamp, int64_t *time_end, int flush);
int vp9_get_preview_raw_frame(VP9_COMP *cpi, YV12_BUFFER_CONFIG *dest,
vp9_ppflags_t *flags);
int vp9_use_as_reference(VP9_COMP *cpi, int ref_frame_flags);
int vp9_update_reference(VP9_COMP *cpi, int ref_frame_flags);
int vp9_copy_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
int vp9_get_reference_enc(VP9_COMP *cpi, int index,
YV12_BUFFER_CONFIG **fb);
int vp9_set_reference_enc(VP9_COMP *cpi, VP9_REFFRAME ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
int vp9_update_entropy(VP9_COMP *cpi, int update);
int vp9_set_roimap(VP9_COMP *cpi, unsigned char *map,
unsigned int rows, unsigned int cols,
int delta_q[MAX_SEGMENTS],
int delta_lf[MAX_SEGMENTS],
unsigned int threshold[MAX_SEGMENTS]);
int vp9_set_active_map(VP9_COMP *cpi, unsigned char *map,
unsigned int rows, unsigned int cols);
int vp9_set_internal_size(VP9_COMP *cpi,
VPX_SCALING horiz_mode, VPX_SCALING vert_mode);
int vp9_set_size_literal(VP9_COMP *cpi, unsigned int width,
unsigned int height);
void vp9_set_svc(VP9_COMP *cpi, int use_svc);
int vp9_get_quantizer(struct VP9_COMP *cpi);
static int get_ref_frame_idx(const VP9_COMP *cpi,
MV_REFERENCE_FRAME ref_frame) {
if (ref_frame == LAST_FRAME) {
......
......@@ -12,7 +12,6 @@ VP9_COMMON_SRCS-yes += vp9_common.mk
VP9_COMMON_SRCS-yes += vp9_iface_common.h
VP9_COMMON_SRCS-yes += common/vp9_pragmas.h
VP9_COMMON_SRCS-yes += common/vp9_ppflags.h
VP9_COMMON_SRCS-yes += common/vp9_onyx.h
VP9_COMMON_SRCS-yes += common/vp9_alloccommon.c
VP9_COMMON_SRCS-yes += common/vp9_blockd.c
VP9_COMMON_SRCS-yes += common/vp9_convolve.c
......
......@@ -17,7 +17,6 @@
#include "vp9/encoder/vp9_onyx_int.h"
#include "vpx/vp8cx.h"
#include "vp9/encoder/vp9_firstpass.h"
#include "vp9/common/vp9_onyx.h"
#include "vp9/vp9_iface_common.h"
struct vp9_extracfg {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment