}
}
+static vpx_codec_err_t get_display_size(vpx_codec_alg_priv_t *ctx,
+ int ctrl_id,
+ va_list args) {
+ int *const display_size = va_arg(args, int *);
+
+ if (display_size) {
+ const VP9D_COMP *const pbi = (VP9D_COMP *)ctx->pbi;
+ if (pbi) {
+ display_size[0] = pbi->common.display_width;
+ display_size[1] = pbi->common.display_height;
+ } else {
+ return VPX_CODEC_ERROR;
+ }
+ return VPX_CODEC_OK;
+ } else {
+ return VPX_CODEC_INVALID_PARAM;
+ }
+}
+
static vpx_codec_err_t set_invert_tile_order(vpx_codec_alg_priv_t *ctx,
int ctr_id,
va_list args) {
{VP8D_GET_LAST_REF_UPDATES, get_last_ref_updates},
{VP8D_GET_FRAME_CORRUPTED, get_frame_corrupted},
{VP9_GET_REFERENCE, get_reference},
+ {VP9D_GET_DISPLAY_SIZE, get_display_size},
{VP9_INVERT_TILE_DECODE_ORDER, set_invert_tile_order},
{ -1, NULL},
};
*/
VP8D_SET_DECRYPTOR,
+ /** control function to get the display dimensions for the current frame. */
+ VP9D_GET_DISPLAY_SIZE,
+
/** For testing. */
VP9_INVERT_TILE_DECODE_ORDER,
VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vp8_decrypt_init *)
+VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *)
VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
/*! @} - end defgroup vp8_decoder */
int frames_corrupted = 0;
int dec_flags = 0;
int do_scale = 0;
- int stream_w = 0, stream_h = 0;
vpx_image_t *scaled_img = NULL;
int frame_avail, got_data;
}
if (do_scale) {
+ int stream_w = 0, stream_h = 0;
if (img && frame_out == 1) {
- stream_w = img->d_w;
- stream_h = img->d_h;
+ int display_size[2];
+ if (vpx_codec_control(&decoder, VP9D_GET_DISPLAY_SIZE,
+ display_size)) {
+ // Fallback to use raw image size if display size not available.
+ stream_w = img->d_w;
+ stream_h = img->d_h;
+ } else {
+ stream_w = display_size[0];
+ stream_h = display_size[1];
+ }
scaled_img = vpx_img_alloc(NULL, VPX_IMG_FMT_I420,
stream_w, stream_h, 16);
}
img = scaled_img;
}
}
-
if (img) {
unsigned int y;
char out_fn[PATH_MAX];