Support 16K sequence coding
Fixed a couple of variable/function definitions, as well as header handling to support 16K sequence coding at high bit-rates. The width and height are each specified by two bytes in the header. Use an extra byte to explicitly indicate the scaling factors in both directions, each ranging from 0 to 15. Tested coding up to 16400x16400 dimension. Change-Id: Ibc2225c6036620270f2c0cf5172d1760aaec10ec
This commit is contained in:
parent
2d3e879fcc
commit
5957b2b514
@ -94,7 +94,7 @@ extern "C"
|
||||
int Width; // width of data passed to the compressor
|
||||
int Height; // height of data passed to the compressor
|
||||
double frame_rate; // set to passed in framerate
|
||||
int target_bandwidth; // bandwidth to be used in kilobits per second
|
||||
int64_t target_bandwidth; // bandwidth to be used in kilobits per second
|
||||
|
||||
int noise_sensitivity; // parameter used for applying pre processing blur: recommendation 0
|
||||
int Sharpness; // parameter used for sharpening output: recommendation 0:
|
||||
@ -135,9 +135,9 @@ extern "C"
|
||||
int over_shoot_pct;
|
||||
|
||||
// buffering parameters
|
||||
int starting_buffer_level; // in seconds
|
||||
int optimal_buffer_level;
|
||||
int maximum_buffer_size;
|
||||
int64_t starting_buffer_level; // in seconds
|
||||
int64_t optimal_buffer_level;
|
||||
int64_t maximum_buffer_size;
|
||||
|
||||
// controlling quality
|
||||
int fixed_q;
|
||||
|
@ -1267,13 +1267,14 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) {
|
||||
* if we have enough data. Otherwise we will end up with the wrong
|
||||
* size.
|
||||
*/
|
||||
if (data + 4 < data_end) {
|
||||
pc->Width = (data[0] | (data[1] << 8)) & 0x3fff;
|
||||
pc->horiz_scale = data[1] >> 6;
|
||||
pc->Height = (data[2] | (data[3] << 8)) & 0x3fff;
|
||||
pc->vert_scale = data[3] >> 6;
|
||||
if (data + 5 < data_end) {
|
||||
pc->Width = (data[0] | (data[1] << 8));
|
||||
pc->Height = (data[2] | (data[3] << 8));
|
||||
|
||||
pc->horiz_scale = data[4] >> 4;
|
||||
pc->vert_scale = data[4] & 0x0F;
|
||||
}
|
||||
data += 4;
|
||||
data += 5;
|
||||
|
||||
if (width != pc->Width || height != pc->Height) {
|
||||
if (pc->Width <= 0) {
|
||||
|
@ -1500,17 +1500,20 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
|
||||
{
|
||||
int v;
|
||||
|
||||
/* TODO(jkoleszar): support arbitrary resolutions */
|
||||
v = (pc->horiz_scale << 14) | pc->Width;
|
||||
// support arbitrary resolutions
|
||||
v = pc->Width;
|
||||
cx_data[0] = v;
|
||||
cx_data[1] = v >> 8;
|
||||
|
||||
v = (pc->vert_scale << 14) | pc->Height;
|
||||
v = pc->Height;
|
||||
cx_data[2] = v;
|
||||
cx_data[3] = v >> 8;
|
||||
|
||||
extra_bytes_packed += 4;
|
||||
cx_data += 4;
|
||||
// use a separate byte to store the scale factors, each ranging 0-15
|
||||
cx_data[4] = (pc->horiz_scale << 4) | (pc->vert_scale);
|
||||
|
||||
extra_bytes_packed += 5;
|
||||
cx_data += 5;
|
||||
}
|
||||
|
||||
vp9_start_encode(&header_bc, cx_data);
|
||||
|
@ -1247,8 +1247,8 @@ static void encode_frame_internal(VP9_COMP *cpi) {
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
int totalrate;
|
||||
|
||||
// printf("encode_frame_internal frame %d (%d)\n",
|
||||
// cpi->common.current_video_frame, cpi->common.show_frame);
|
||||
// fprintf(stderr, "encode_frame_internal frame %d (%d)\n",
|
||||
// cpi->common.current_video_frame, cpi->common.show_frame);
|
||||
|
||||
// Compute a modified set of reference frame probabilities to use when
|
||||
// prediction fails. These are based on the current general estimates for
|
||||
@ -1329,12 +1329,11 @@ static void encode_frame_internal(VP9_COMP *cpi) {
|
||||
// Take tiles into account and give start/end MB
|
||||
int tile_col;
|
||||
TOKENEXTRA *tp = cpi->tok;
|
||||
|
||||
for (tile_col = 0; tile_col < cm->tile_columns; tile_col++) {
|
||||
TOKENEXTRA *tp_old = tp;
|
||||
|
||||
// For each row of SBs in the frame
|
||||
vp9_get_tile_col_offsets(cm, tile_col);
|
||||
|
||||
for (mb_row = 0; mb_row < cm->mb_rows; mb_row += 4) {
|
||||
encode_sb_row(cpi, mb_row, &tp, &totalrate);
|
||||
}
|
||||
|
@ -1086,14 +1086,12 @@ void vp9_new_frame_rate(VP9_COMP *cpi, double framerate) {
|
||||
cpi->max_gf_interval = cpi->twopass.static_scene_max_gf_interval;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
rescale(int val, int num, int denom) {
|
||||
static int64_t rescale(int val, int64_t num, int denom) {
|
||||
int64_t llnum = num;
|
||||
int64_t llden = denom;
|
||||
int64_t llval = val;
|
||||
|
||||
return (int)(llval * llnum / llden);
|
||||
return (llval * llnum / llden);
|
||||
}
|
||||
|
||||
static void set_tile_limits(VP9_COMP *cpi) {
|
||||
|
@ -485,7 +485,7 @@ typedef struct VP9_COMP {
|
||||
int kf_boost;
|
||||
int kf_zeromotion_pct;
|
||||
|
||||
int target_bandwidth;
|
||||
int64_t target_bandwidth;
|
||||
struct vpx_codec_pkt_list *output_pkt_list;
|
||||
|
||||
#if 0
|
||||
|
@ -126,8 +126,8 @@ update_error_state(vpx_codec_alg_priv_t *ctx,
|
||||
static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
|
||||
const vpx_codec_enc_cfg_t *cfg,
|
||||
const struct vp8_extracfg *vp8_cfg) {
|
||||
RANGE_CHECK(cfg, g_w, 1, 16383); /* 14 bits available */
|
||||
RANGE_CHECK(cfg, g_h, 1, 16383); /* 14 bits available */
|
||||
RANGE_CHECK(cfg, g_w, 1, 65535); /* 16 bits available */
|
||||
RANGE_CHECK(cfg, g_h, 1, 65535); /* 16 bits available */
|
||||
RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000);
|
||||
RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den);
|
||||
RANGE_CHECK_HI(cfg, g_profile, 3);
|
||||
|
@ -229,8 +229,8 @@ static vpx_codec_err_t vp8_peek_si(const uint8_t *data,
|
||||
if (c[0] != 0x9d || c[1] != 0x01 || c[2] != 0x2a)
|
||||
res = VPX_CODEC_UNSUP_BITSTREAM;
|
||||
|
||||
si->w = (c[3] | (c[4] << 8)) & 0x3fff;
|
||||
si->h = (c[5] | (c[6] << 8)) & 0x3fff;
|
||||
si->w = (c[3] | (c[4] << 8));
|
||||
si->h = (c[5] | (c[6] << 8));
|
||||
|
||||
/*printf("w=%d, h=%d\n", si->w, si->h);*/
|
||||
if (!(si->h | si->w))
|
||||
|
Loading…
Reference in New Issue
Block a user