Commit 36ffe644 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Rename display_{size,width,height} to render_*.

The name "display_*" (or "d_*") is used for non-compatible information
(that is, the cropped frame dimensions in pixels, as opposed to the
intended screen rendering surface size). Therefore, continuing to use
display_* would be confusing to end users. Instead, rename the field
to render_*, so that struct vpx_image can include it.

Change-Id: Iab8d2eae96492b71c4ea60c4bce8121cb2a1fe2d
parent 8979e9e3
......@@ -132,8 +132,8 @@ typedef struct VP10Common {
int color_range;
int width;
int height;
int display_width;
int display_height;
int render_width;
int render_height;
int last_width;
int last_height;
......
......@@ -1176,12 +1176,12 @@ static INTERP_FILTER read_interp_filter(struct vpx_read_bit_buffer *rb) {
return vpx_rb_read_bit(rb) ? SWITCHABLE : vpx_rb_read_literal(rb, 2);
}
static void setup_display_size(VP10_COMMON *cm,
struct vpx_read_bit_buffer *rb) {
cm->display_width = cm->width;
cm->display_height = cm->height;
static void setup_render_size(VP10_COMMON *cm,
struct vpx_read_bit_buffer *rb) {
cm->render_width = cm->width;
cm->render_height = cm->height;
if (vpx_rb_read_bit(rb))
vp10_read_frame_size(rb, &cm->display_width, &cm->display_height);
vp10_read_frame_size(rb, &cm->render_width, &cm->render_height);
}
static void resize_mv_buffer(VP10_COMMON *cm) {
......@@ -1229,7 +1229,7 @@ static void setup_frame_size(VP10_COMMON *cm, struct vpx_read_bit_buffer *rb) {
BufferPool *const pool = cm->buffer_pool;
vp10_read_frame_size(rb, &width, &height);
resize_context_buffers(cm, width, height);
setup_display_size(cm, rb);
setup_render_size(cm, rb);
lock_buffer_pool(pool);
if (vpx_realloc_frame_buffer(
......@@ -1311,7 +1311,7 @@ static void setup_frame_size_with_refs(VP10_COMMON *cm,
}
resize_context_buffers(cm, width, height);
setup_display_size(cm, rb);
setup_render_size(cm, rb);
lock_buffer_pool(pool);
if (vpx_realloc_frame_buffer(
......
......@@ -982,14 +982,14 @@ static size_t encode_tiles(VP10_COMP *cpi, uint8_t *data_ptr) {
return total_size;
}
static void write_display_size(const VP10_COMMON *cm,
struct vpx_write_bit_buffer *wb) {
const int scaling_active = cm->width != cm->display_width ||
cm->height != cm->display_height;
static void write_render_size(const VP10_COMMON *cm,
struct vpx_write_bit_buffer *wb) {
const int scaling_active = cm->width != cm->render_width ||
cm->height != cm->render_height;
vpx_wb_write_bit(wb, scaling_active);
if (scaling_active) {
vpx_wb_write_literal(wb, cm->display_width - 1, 16);
vpx_wb_write_literal(wb, cm->display_height - 1, 16);
vpx_wb_write_literal(wb, cm->render_width - 1, 16);
vpx_wb_write_literal(wb, cm->render_height - 1, 16);
}
}
......@@ -998,7 +998,7 @@ static void write_frame_size(const VP10_COMMON *cm,
vpx_wb_write_literal(wb, cm->width - 1, 16);
vpx_wb_write_literal(wb, cm->height - 1, 16);
write_display_size(cm, wb);
write_render_size(cm, wb);
}
static void write_frame_size_with_refs(VP10_COMP *cpi,
......@@ -1025,7 +1025,7 @@ static void write_frame_size_with_refs(VP10_COMP *cpi,
vpx_wb_write_literal(wb, cm->height - 1, 16);
}
write_display_size(cm, wb);
write_render_size(cm, wb);
}
static void write_sync_code(struct vpx_write_bit_buffer *wb) {
......
......@@ -1455,8 +1455,8 @@ void vp10_change_config(struct VP10_COMP *cpi, const VP10EncoderConfig *oxcf) {
cm->interp_filter = cpi->sf.default_interp_filter;
cm->display_width = cpi->oxcf.width;
cm->display_height = cpi->oxcf.height;
cm->render_width = cpi->oxcf.width;
cm->render_height = cpi->oxcf.height;
cm->width = cpi->oxcf.width;
cm->height = cpi->oxcf.height;
......
......@@ -978,9 +978,9 @@ static vpx_codec_err_t ctrl_get_frame_size(vpx_codec_alg_priv_t *ctx,
return VPX_CODEC_INVALID_PARAM;
}
static vpx_codec_err_t ctrl_get_display_size(vpx_codec_alg_priv_t *ctx,
va_list args) {
int *const display_size = va_arg(args, int *);
static vpx_codec_err_t ctrl_get_render_size(vpx_codec_alg_priv_t *ctx,
va_list args) {
int *const render_size = va_arg(args, int *);
// Only support this function in serial decode.
if (ctx->frame_parallel_decode) {
......@@ -988,14 +988,14 @@ static vpx_codec_err_t ctrl_get_display_size(vpx_codec_alg_priv_t *ctx,
return VPX_CODEC_INCAPABLE;
}
if (display_size) {
if (render_size) {
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
const VP10_COMMON *const cm = &frame_worker_data->pbi->common;
display_size[0] = cm->display_width;
display_size[1] = cm->display_height;
render_size[0] = cm->render_width;
render_size[1] = cm->render_height;
return VPX_CODEC_OK;
} else {
return VPX_CODEC_ERROR;
......@@ -1094,7 +1094,7 @@ static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
{VP8D_GET_LAST_REF_UPDATES, ctrl_get_last_ref_updates},
{VP8D_GET_FRAME_CORRUPTED, ctrl_get_frame_corrupted},
{VP9_GET_REFERENCE, ctrl_get_reference},
{VP9D_GET_DISPLAY_SIZE, ctrl_get_display_size},
{VP9D_GET_DISPLAY_SIZE, ctrl_get_render_size},
{VP9D_GET_BIT_DEPTH, ctrl_get_bit_depth},
{VP9D_GET_FRAME_SIZE, ctrl_get_frame_size},
......
......@@ -115,8 +115,8 @@ typedef struct VP9Common {
int color_range;
int width;
int height;
int display_width;
int display_height;
int render_width;
int render_height;
int last_width;
int last_height;
......
......@@ -1181,11 +1181,11 @@ static INTERP_FILTER read_interp_filter(struct vpx_read_bit_buffer *rb) {
: literal_to_filter[vpx_rb_read_literal(rb, 2)];
}
static void setup_display_size(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
cm->display_width = cm->width;
cm->display_height = cm->height;
static void setup_render_size(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
cm->render_width = cm->width;
cm->render_height = cm->height;
if (vpx_rb_read_bit(rb))
vp9_read_frame_size(rb, &cm->display_width, &cm->display_height);
vp9_read_frame_size(rb, &cm->render_width, &cm->render_height);
}
static void resize_mv_buffer(VP9_COMMON *cm) {
......@@ -1233,7 +1233,7 @@ static void setup_frame_size(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
BufferPool *const pool = cm->buffer_pool;
vp9_read_frame_size(rb, &width, &height);
resize_context_buffers(cm, width, height);
setup_display_size(cm, rb);
setup_render_size(cm, rb);
lock_buffer_pool(pool);
if (vpx_realloc_frame_buffer(
......@@ -1315,7 +1315,7 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
}
resize_context_buffers(cm, width, height);
setup_display_size(cm, rb);
setup_render_size(cm, rb);
lock_buffer_pool(pool);
if (vpx_realloc_frame_buffer(
......
......@@ -969,14 +969,14 @@ static size_t encode_tiles(VP9_COMP *cpi, uint8_t *data_ptr) {
return total_size;
}
static void write_display_size(const VP9_COMMON *cm,
struct vpx_write_bit_buffer *wb) {
const int scaling_active = cm->width != cm->display_width ||
cm->height != cm->display_height;
static void write_render_size(const VP9_COMMON *cm,
struct vpx_write_bit_buffer *wb) {
const int scaling_active = cm->width != cm->render_width ||
cm->height != cm->render_height;
vpx_wb_write_bit(wb, scaling_active);
if (scaling_active) {
vpx_wb_write_literal(wb, cm->display_width - 1, 16);
vpx_wb_write_literal(wb, cm->display_height - 1, 16);
vpx_wb_write_literal(wb, cm->render_width - 1, 16);
vpx_wb_write_literal(wb, cm->render_height - 1, 16);
}
}
......@@ -985,7 +985,7 @@ static void write_frame_size(const VP9_COMMON *cm,
vpx_wb_write_literal(wb, cm->width - 1, 16);
vpx_wb_write_literal(wb, cm->height - 1, 16);
write_display_size(cm, wb);
write_render_size(cm, wb);
}
static void write_frame_size_with_refs(VP9_COMP *cpi,
......@@ -1023,7 +1023,7 @@ static void write_frame_size_with_refs(VP9_COMP *cpi,
vpx_wb_write_literal(wb, cm->height - 1, 16);
}
write_display_size(cm, wb);
write_render_size(cm, wb);
}
static void write_sync_code(struct vpx_write_bit_buffer *wb) {
......
......@@ -1509,8 +1509,8 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
cm->interp_filter = cpi->sf.default_interp_filter;
cm->display_width = cpi->oxcf.width;
cm->display_height = cpi->oxcf.height;
cm->render_width = cpi->oxcf.width;
cm->render_height = cpi->oxcf.height;
if (last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) {
cm->width = cpi->oxcf.width;
cm->height = cpi->oxcf.height;
......
......@@ -979,9 +979,9 @@ static vpx_codec_err_t ctrl_get_frame_size(vpx_codec_alg_priv_t *ctx,
return VPX_CODEC_INVALID_PARAM;
}
static vpx_codec_err_t ctrl_get_display_size(vpx_codec_alg_priv_t *ctx,
va_list args) {
int *const display_size = va_arg(args, int *);
static vpx_codec_err_t ctrl_get_render_size(vpx_codec_alg_priv_t *ctx,
va_list args) {
int *const render_size = va_arg(args, int *);
// Only support this function in serial decode.
if (ctx->frame_parallel_decode) {
......@@ -989,14 +989,14 @@ static vpx_codec_err_t ctrl_get_display_size(vpx_codec_alg_priv_t *ctx,
return VPX_CODEC_INCAPABLE;
}
if (display_size) {
if (render_size) {
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
const VP9_COMMON *const cm = &frame_worker_data->pbi->common;
display_size[0] = cm->display_width;
display_size[1] = cm->display_height;
render_size[0] = cm->render_width;
render_size[1] = cm->render_height;
return VPX_CODEC_OK;
} else {
return VPX_CODEC_ERROR;
......@@ -1095,7 +1095,7 @@ static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
{VP8D_GET_LAST_REF_UPDATES, ctrl_get_last_ref_updates},
{VP8D_GET_FRAME_CORRUPTED, ctrl_get_frame_corrupted},
{VP9_GET_REFERENCE, ctrl_get_reference},
{VP9D_GET_DISPLAY_SIZE, ctrl_get_display_size},
{VP9D_GET_DISPLAY_SIZE, ctrl_get_render_size},
{VP9D_GET_BIT_DEPTH, ctrl_get_bit_depth},
{VP9D_GET_FRAME_SIZE, ctrl_get_frame_size},
......
......@@ -953,22 +953,22 @@ static int main_loop(int argc, const char **argv_) {
// these is set to 0, use the display size set in the first frame
// header. If that is unavailable, use the raw decoded size of the
// first decoded frame.
int display_width = vpx_input_ctx.width;
int display_height = vpx_input_ctx.height;
if (!display_width || !display_height) {
int display_size[2];
int render_width = vpx_input_ctx.width;
int render_height = vpx_input_ctx.height;
if (!render_width || !render_height) {
int render_size[2];
if (vpx_codec_control(&decoder, VP9D_GET_DISPLAY_SIZE,
display_size)) {
render_size)) {
// As last resort use size of first frame as display size.
display_width = img->d_w;
display_height = img->d_h;
render_width = img->d_w;
render_height = img->d_h;
} else {
display_width = display_size[0];
display_height = display_size[1];
render_width = render_size[0];
render_height = render_size[1];
}
}
scaled_img = vpx_img_alloc(NULL, img->fmt, display_width,
display_height, 16);
scaled_img = vpx_img_alloc(NULL, img->fmt, render_width,
render_height, 16);
scaled_img->bit_depth = img->bit_depth;
}
......
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