ref: 5957b2b514f12fcb9549f3a97ec82dbab34f1ad7
parent: 2d3e879fccef330d89f5e5ae6c718cb37d888d2a
author: Jingning Han <jingning@google.com>
date: Wed Feb 27 12:09:12 EST 2013
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
--- a/vp9/common/vp9_onyx.h
+++ b/vp9/common/vp9_onyx.h
@@ -94,7 +94,7 @@
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 @@
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;
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -1267,13 +1267,14 @@
* 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) {
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -1500,17 +1500,20 @@
{
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);
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1247,8 +1247,8 @@
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 @@
// 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);
}
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1086,14 +1086,12 @@
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) {
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -485,7 +485,7 @@
int kf_boost;
int kf_zeromotion_pct;
- int target_bandwidth;
+ int64_t target_bandwidth;
struct vpx_codec_pkt_list *output_pkt_list;
#if 0
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -126,8 +126,8 @@
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);
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -229,8 +229,8 @@
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))
--
⑨