Commit c147c4d6 authored by Yunqing Wang's avatar Yunqing Wang

vp10 cleanup: remove svc code

Spatial/temporal svc code was removed. Verified using Borg test,
and the results before and after the change are matching.

Change-Id: I4c2ee5cd560428e3e50be02e57e5871ef4246390
parent 5c245a46
......@@ -291,7 +291,7 @@ void vp10_cyclic_refresh_postencode(VP10_COMP *const cpi) {
}
}
// Set golden frame update interval, for non-svc 1 pass CBR mode.
// Set golden frame update interval, for 1 pass CBR mode.
void vp10_cyclic_refresh_set_golden_update(VP10_COMP *const cpi) {
RATE_CONTROL *const rc = &cpi->rc;
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
......@@ -484,10 +484,7 @@ void vp10_cyclic_refresh_setup(VP10_COMP *const cpi) {
if (cm->current_video_frame == 0)
cr->low_content_avg = 0.0;
// Don't apply refresh on key frame or enhancement layer frames.
if (!apply_cyclic_refresh ||
(cm->frame_type == KEY_FRAME) ||
(cpi->svc.temporal_layer_id > 0) ||
(cpi->svc.spatial_layer_id > 0)) {
if (!apply_cyclic_refresh || cm->frame_type == KEY_FRAME) {
// Set segmentation map to 0 and disable.
unsigned char *const seg_map = cpi->segmentation_map;
memset(seg_map, 0, cm->mi_rows * cm->mi_cols);
......
......@@ -61,7 +61,7 @@ void vp10_cyclic_refresh_update__map(struct VP10_COMP *const cpi);
// Update the actual number of blocks that were applied the segment delta q.
void vp10_cyclic_refresh_postencode(struct VP10_COMP *const cpi);
// Set golden frame update interval, for non-svc 1 pass CBR mode.
// Set golden frame update interval, for 1 pass CBR mode.
void vp10_cyclic_refresh_set_golden_update(struct VP10_COMP *const cpi);
// Check if we should not update golden reference, based on past refresh stats.
......
......@@ -996,18 +996,7 @@ static void write_frame_size_with_refs(VP10_COMP *cpi,
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, ref_frame);
// Set "found" to 0 for temporal svc and for spatial svc key frame
if (cpi->use_svc &&
((cpi->svc.number_temporal_layers > 1 &&
cpi->oxcf.rc_mode == VPX_CBR) ||
(cpi->svc.number_spatial_layers > 1 &&
cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame) ||
(is_two_pass_svc(cpi) &&
cpi->svc.encode_empty_frame_state == ENCODING &&
cpi->svc.layer_context[0].frames_from_key_frame <
cpi->svc.number_temporal_layers + 1))) {
found = 0;
} else if (cfg != NULL) {
if (cfg != NULL) {
found = cm->width == cfg->y_crop_width &&
cm->height == cfg->y_crop_height;
}
......@@ -1093,14 +1082,6 @@ static void write_uncompressed_header(VP10_COMP *cpi,
write_bitdepth_colorspace_sampling(cm, wb);
write_frame_size(cm, wb);
} else {
// In spatial svc if it's not error_resilient_mode then we need to code all
// visible frames as invisible. But we need to keep the show_frame flag so
// that the publisher could know whether it is supposed to be visible.
// So we will code the show_frame flag as it is. Then code the intra_only
// bit here. This will make the bitstream incompatible. In the player we
// will change to show_frame flag to 0, then add an one byte frame with
// show_existing_frame flag which tells the decoder which frame we want to
// show.
if (!cm->show_frame)
vpx_wb_write_bit(wb, cm->intra_only);
......
......@@ -22,12 +22,7 @@ void vp10_pack_bitstream(VP10_COMP *cpi, uint8_t *dest, size_t *size);
static INLINE int vp10_preserve_existing_gf(VP10_COMP *cpi) {
return !cpi->multi_arf_allowed && cpi->refresh_golden_frame &&
cpi->rc.is_src_frame_alt_ref &&
(!cpi->use_svc || // Add spatial svc base layer case here
(is_two_pass_svc(cpi) &&
cpi->svc.spatial_layer_id == 0 &&
cpi->svc.layer_context[0].gold_ref_idx >=0 &&
cpi->oxcf.ss_enable_auto_arf[0]));
cpi->rc.is_src_frame_alt_ref;
}
#ifdef __cplusplus
......
......@@ -695,11 +695,7 @@ static int choose_partitioning(VP10_COMP *cpi,
s = x->plane[0].src.buf;
sp = x->plane[0].src.stride;
if (!is_key_frame && !(is_one_pass_cbr_svc(cpi) &&
cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame)) {
// In the case of spatial/temporal scalable coding, the assumption here is
// that the temporal reference frame will always be of type LAST_FRAME.
// TODO(marpan): If that assumption is broken, we need to revisit this code.
if (!is_key_frame) {
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
unsigned int uv_sad;
const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
......@@ -710,12 +706,7 @@ static int choose_partitioning(VP10_COMP *cpi,
+ (mi_col + 4 < cm->mi_cols) * 2 + (mi_row + 4 < cm->mi_rows);
assert(yv12 != NULL);
if (!(is_one_pass_cbr_svc(cpi) && cpi->svc.spatial_layer_id)) {
// For now, GOLDEN will not be used for non-zero spatial layers, since
// it may not be a temporal reference.
yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
}
yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
if (yv12_g && yv12_g != yv12) {
vp10_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col,
......@@ -851,9 +842,7 @@ static int choose_partitioning(VP10_COMP *cpi,
}
}
}
// TODO(marpan): There is an issue with variance based on 4x4 average in
// svc mode, don't allow it for now.
if (is_key_frame || (low_res && !cpi->use_svc &&
if (is_key_frame || (low_res &&
vt.split[i].split[j].part_variances.none.variance >
(thresholds[1] << 1))) {
force_split[split_index] = 0;
......
This diff is collapsed.
......@@ -33,7 +33,6 @@
#include "vp10/encoder/ratectrl.h"
#include "vp10/encoder/rd.h"
#include "vp10/encoder/speed_features.h"
#include "vp10/encoder/svc_layercontext.h"
#include "vp10/encoder/tokenize.h"
#if CONFIG_VP9_TEMPORAL_DENOISING
......@@ -116,7 +115,7 @@ typedef enum {
} AQ_MODE;
typedef enum {
RESIZE_NONE = 0, // No frame resizing allowed (except for SVC).
RESIZE_NONE = 0, // No frame resizing allowed.
RESIZE_FIXED = 1, // All frames are coded at the specified dimension.
RESIZE_DYNAMIC = 2 // Coded size of each frame is determined by the codec.
} RESIZE_TYPE;
......@@ -189,16 +188,6 @@ typedef struct VP10EncoderConfig {
// 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 layer_target_bitrate[VPX_MAX_LAYERS];
int ss_target_bitrate[VPX_SS_MAX_LAYERS];
int ss_enable_auto_arf[VPX_SS_MAX_LAYERS];
// Bitrate allocation (CBR mode) and framerate factor, for temporal layers.
int ts_rate_decimator[VPX_TS_MAX_LAYERS];
int enable_auto_arf;
int encode_breakout; // early breakout : for video conf recommend 800
......@@ -239,7 +228,6 @@ typedef struct VP10EncoderConfig {
int use_highbitdepth;
#endif
vpx_color_space_t color_space;
VP9E_TEMPORAL_LAYERING_MODE temporal_layering_mode;
} VP10EncoderConfig;
static INLINE int is_lossless_requested(const VP10EncoderConfig *cfg) {
......@@ -451,10 +439,6 @@ typedef struct VP10_COMP {
// number of MBs in the current frame when the frame is
// scaled.
int use_svc;
SVC svc;
// Store frame variance info in SOURCE_VAR_BASED_PARTITION search type.
diff *source_diff_var;
// The threshold used in SOURCE_VAR_BASED_PARTITION search type.
......@@ -546,8 +530,6 @@ int vp10_set_internal_size(VP10_COMP *cpi,
int vp10_set_size_literal(VP10_COMP *cpi, unsigned int width,
unsigned int height);
void vp10_set_svc(VP10_COMP *cpi, int use_svc);
int vp10_get_quantizer(struct VP10_COMP *cpi);
static INLINE int frame_is_kf_gf_arf(const VP10_COMP *cpi) {
......@@ -624,19 +606,9 @@ YV12_BUFFER_CONFIG *vp10_scale_if_required(VP10_COMMON *cm,
void vp10_apply_encoding_flags(VP10_COMP *cpi, vpx_enc_frame_flags_t flags);
static INLINE int is_two_pass_svc(const struct VP10_COMP *const cpi) {
return cpi->use_svc && cpi->oxcf.pass != 0;
}
static INLINE int is_one_pass_cbr_svc(const struct VP10_COMP *const cpi) {
return (cpi->use_svc && cpi->oxcf.pass == 0);
}
static INLINE int is_altref_enabled(const VP10_COMP *const cpi) {
return cpi->oxcf.mode != REALTIME && cpi->oxcf.lag_in_frames > 0 &&
(cpi->oxcf.enable_auto_arf &&
(!is_two_pass_svc(cpi) ||
cpi->oxcf.ss_enable_auto_arf[cpi->svc.spatial_layer_id]));
cpi->oxcf.enable_auto_arf;
}
static INLINE void set_ref_ptrs(VP10_COMMON *cm, MACROBLOCKD *xd,
......
......@@ -76,13 +76,6 @@ void vp10_encode_tiles_mt(VP10_COMP *cpi) {
if (cpi->num_workers == 0) {
int allocated_workers = num_workers;
// While using SVC, we need to allocate threads according to the highest
// resolution.
if (cpi->use_svc) {
int max_tile_cols = get_max_tile_cols(cpi);
allocated_workers = VPXMIN(cpi->oxcf.max_threads, max_tile_cols);
}
CHECK_MEM_ERROR(cm, cpi->workers,
vpx_malloc(allocated_workers * sizeof(*cpi->workers)));
......
This diff is collapsed.
......@@ -64,7 +64,6 @@ typedef struct {
double new_mv_count;
double duration;
double count;
int64_t spatial_layer_id;
} FIRSTPASS_STATS;
typedef enum {
......
......@@ -14,11 +14,6 @@
#include "vpx_scale/yv12config.h"
#include "vpx/vpx_integer.h"
#if CONFIG_SPATIAL_SVC
#include "vpx/vp8cx.h"
#include "vpx/vpx_encoder.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
......
This diff is collapsed.
......@@ -169,7 +169,6 @@ int vp10_rc_get_default_max_gf_interval(double framerate, int min_frame_rate);
// First call per frame, one of:
// vp10_rc_get_one_pass_vbr_params()
// vp10_rc_get_one_pass_cbr_params()
// vp10_rc_get_svc_params()
// vp10_rc_get_first_pass_params()
// vp10_rc_get_second_pass_params()
// depending on the usage to set the rate control encode parameters desired.
......@@ -190,7 +189,6 @@ int vp10_rc_get_default_max_gf_interval(double framerate, int min_frame_rate);
// encode_frame_to_data_rate() function.
void vp10_rc_get_one_pass_vbr_params(struct VP10_COMP *cpi);
void vp10_rc_get_one_pass_cbr_params(struct VP10_COMP *cpi);
void vp10_rc_get_svc_params(struct VP10_COMP *cpi);
// Post encode update of the rate control parameters based
// on bytes used
......
......@@ -18,7 +18,7 @@
// Intra only frames, golden frames (except alt ref overlays) and
// alt ref frames tend to be coded at a higher than ambient quality
static int frame_is_boosted(const VP10_COMP *cpi) {
return frame_is_kf_gf_arf(cpi) || vp10_is_upper_layer_key_frame(cpi);
return frame_is_kf_gf_arf(cpi);
}
// Sets a partition size down to which the auto partition code will always
......@@ -284,8 +284,7 @@ static void set_rt_speed_feature(VP10_COMP *cpi, SPEED_FEATURES *sf,
// pred_mv_sad will not be set (since vp10_mv_pred will not
// be called).
// TODO(marpan/agrange): Fix this condition.
sf->reference_masking = (cpi->oxcf.resize_mode != RESIZE_DYNAMIC &&
cpi->svc.number_spatial_layers == 1) ? 1 : 0;
sf->reference_masking = (cpi->oxcf.resize_mode != RESIZE_DYNAMIC) ? 1 : 0;
sf->disable_filter_search_var_thresh = 50;
sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
......
This diff is collapsed.
/*
* Copyright (c) 2014 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 VP10_ENCODER_SVC_LAYERCONTEXT_H_
#define VP10_ENCODER_SVC_LAYERCONTEXT_H_
#include "vpx/vpx_encoder.h"
#include "vp10/encoder/ratectrl.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
RATE_CONTROL rc;
int target_bandwidth;
int spatial_layer_target_bandwidth; // Target for the spatial layer.
double framerate;
int avg_frame_size;
int max_q;
int min_q;
int scaling_factor_num;
int scaling_factor_den;
TWO_PASS twopass;
vpx_fixed_buf_t rc_twopass_stats_in;
unsigned int current_video_frame_in_layer;
int is_key_frame;
int frames_from_key_frame;
FRAME_TYPE last_frame_type;
struct lookahead_entry *alt_ref_source;
int alt_ref_idx;
int gold_ref_idx;
int has_alt_frame;
size_t layer_size;
struct vpx_psnr_pkt psnr_pkt;
} LAYER_CONTEXT;
typedef struct {
int spatial_layer_id;
int temporal_layer_id;
int number_spatial_layers;
int number_temporal_layers;
int spatial_layer_to_encode;
// Workaround for multiple frame contexts
enum {
ENCODED = 0,
ENCODING,
NEED_TO_ENCODE
}encode_empty_frame_state;
struct lookahead_entry empty_frame;
int encode_intra_empty_frame;
// Store scaled source frames to be used for temporal filter to generate
// a alt ref frame.
YV12_BUFFER_CONFIG scaled_frames[MAX_LAG_BUFFERS];
// Layer context used for rate control in one pass temporal CBR mode or
// two pass spatial mode.
LAYER_CONTEXT layer_context[VPX_MAX_LAYERS];
// Indicates what sort of temporal layering is used.
// Currently, this only works for CBR mode.
VP9E_TEMPORAL_LAYERING_MODE temporal_layering_mode;
} SVC;
struct VP10_COMP;
// Initialize layer context data from init_config().
void vp10_init_layer_context(struct VP10_COMP *const cpi);
// Update the layer context from a change_config() call.
void vp10_update_layer_context_change_config(struct VP10_COMP *const cpi,
const int target_bandwidth);
// Prior to encoding the frame, update framerate-related quantities
// for the current temporal layer.
void vp10_update_temporal_layer_framerate(struct VP10_COMP *const cpi);
// Update framerate-related quantities for the current spatial layer.
void vp10_update_spatial_layer_framerate(struct VP10_COMP *const cpi,
double framerate);
// Prior to encoding the frame, set the layer context, for the current layer
// to be encoded, to the cpi struct.
void vp10_restore_layer_context(struct VP10_COMP *const cpi);
// Save the layer context after encoding the frame.
void vp10_save_layer_context(struct VP10_COMP *const cpi);
// Initialize second pass rc for spatial svc.
void vp10_init_second_pass_spatial_svc(struct VP10_COMP *cpi);
// Increment number of video frames in layer
void vp10_inc_frame_in_layer(struct VP10_COMP *const cpi);
// Check if current layer is key frame in spatial upper layer
int vp10_is_upper_layer_key_frame(const struct VP10_COMP *const cpi);
// Get the next source buffer to encode
struct lookahead_entry *vp10_svc_lookahead_pop(struct VP10_COMP *const cpi,
struct lookahead_ctx *ctx,
int drain);
// Start a frame and initialize svc parameters
int vp10_svc_start_frame(struct VP10_COMP *const cpi);
int vp10_one_pass_cbr_svc_start_layer(struct VP10_COMP *const cpi);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // VP10_ENCODER_SVC_LAYERCONTEXT_
......@@ -652,9 +652,7 @@ static void adjust_arnr_filter(VP10_COMP *cpi,
}
void vp10_temporal_filter(VP10_COMP *cpi, int distance) {
VP10_COMMON *const cm = &cpi->common;
RATE_CONTROL *const rc = &cpi->rc;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
int frame;
int frames_to_blur;
int start_frame;
......@@ -681,67 +679,21 @@ void vp10_temporal_filter(VP10_COMP *cpi, int distance) {
if (frames_to_blur > 0) {
// Setup scaling factors. Scaling on each of the arnr frames is not
// supported.
if (cpi->use_svc) {
// In spatial svc the scaling factors might be less then 1/2.
// So we will use non-normative scaling.
int frame_used = 0;
// ARF is produced at the native frame size and resized when coded.
#if CONFIG_VP9_HIGHBITDEPTH
vp10_setup_scale_factors_for_frame(
&sf,
get_frame_new_buffer(cm)->y_crop_width,
get_frame_new_buffer(cm)->y_crop_height,
get_frame_new_buffer(cm)->y_crop_width,
get_frame_new_buffer(cm)->y_crop_height,
cm->use_highbitdepth);
vp10_setup_scale_factors_for_frame(&sf,
frames[0]->y_crop_width,
frames[0]->y_crop_height,
frames[0]->y_crop_width,
frames[0]->y_crop_height,
cm->use_highbitdepth);
#else
vp10_setup_scale_factors_for_frame(
&sf,
get_frame_new_buffer(cm)->y_crop_width,
get_frame_new_buffer(cm)->y_crop_height,
get_frame_new_buffer(cm)->y_crop_width,
get_frame_new_buffer(cm)->y_crop_height);
vp10_setup_scale_factors_for_frame(&sf,
frames[0]->y_crop_width,
frames[0]->y_crop_height,
frames[0]->y_crop_width,
frames[0]->y_crop_height);
#endif // CONFIG_VP9_HIGHBITDEPTH
for (frame = 0; frame < frames_to_blur; ++frame) {
if (cm->mi_cols * MI_SIZE != frames[frame]->y_width ||
cm->mi_rows * MI_SIZE != frames[frame]->y_height) {
if (vpx_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used],
cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS,
cm->byte_alignment,
NULL, NULL, NULL)) {
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to reallocate alt_ref_buffer");
}
frames[frame] = vp10_scale_if_required(
cm, frames[frame], &cpi->svc.scaled_frames[frame_used]);
++frame_used;
}
}
cm->mi = cm->mip + cm->mi_stride + 1;
xd->mi = cm->mi_grid_visible;
xd->mi[0] = cm->mi;
} else {
// ARF is produced at the native frame size and resized when coded.
#if CONFIG_VP9_HIGHBITDEPTH
vp10_setup_scale_factors_for_frame(&sf,
frames[0]->y_crop_width,
frames[0]->y_crop_height,
frames[0]->y_crop_width,
frames[0]->y_crop_height,
cm->use_highbitdepth);
#else
vp10_setup_scale_factors_for_frame(&sf,
frames[0]->y_crop_width,
frames[0]->y_crop_height,
frames[0]->y_crop_width,
frames[0]->y_crop_height);
#endif // CONFIG_VP9_HIGHBITDEPTH
}
}
temporal_filter_iterate_c(cpi, frames, frames_to_blur,
......
This diff is collapsed.
......@@ -48,7 +48,6 @@ VP10_CX_SRCS-yes += encoder/quantize.h
VP10_CX_SRCS-yes += encoder/ratectrl.h
VP10_CX_SRCS-yes += encoder/rd.h
VP10_CX_SRCS-yes += encoder/rdopt.h
VP10_CX_SRCS-yes += encoder/svc_layercontext.h
VP10_CX_SRCS-yes += encoder/tokenize.h
VP10_CX_SRCS-yes += encoder/treewriter.h
VP10_CX_SRCS-yes += encoder/mcomp.c
......@@ -65,7 +64,6 @@ VP10_CX_SRCS-yes += encoder/speed_features.c
VP10_CX_SRCS-yes += encoder/speed_features.h
VP10_CX_SRCS-yes += encoder/subexp.c
VP10_CX_SRCS-yes += encoder/subexp.h
VP10_CX_SRCS-yes += encoder/svc_layercontext.c
VP10_CX_SRCS-yes += encoder/resize.c
VP10_CX_SRCS-yes += encoder/resize.h
VP10_CX_SRCS-$(CONFIG_INTERNAL_STATS) += encoder/blockiness.c
......
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