Merge "Add VP9 decoder control to get frame size"
This commit is contained in:
commit
1cfbc86e38
@ -80,6 +80,7 @@ void TestVp9Controls(vpx_codec_ctx_t *dec) {
|
||||
VP8D_GET_LAST_REF_UPDATES,
|
||||
VP8D_GET_FRAME_CORRUPTED,
|
||||
VP9D_GET_DISPLAY_SIZE,
|
||||
VP9D_GET_FRAME_SIZE
|
||||
};
|
||||
int val[2];
|
||||
|
||||
|
@ -923,6 +923,33 @@ static vpx_codec_err_t ctrl_get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
static vpx_codec_err_t ctrl_get_frame_size(vpx_codec_alg_priv_t *ctx,
|
||||
va_list args) {
|
||||
int *const frame_size = va_arg(args, int *);
|
||||
|
||||
// Only support this function in serial decode.
|
||||
if (ctx->frame_parallel_decode) {
|
||||
set_error_detail(ctx, "Not supported in frame parallel decode");
|
||||
return VPX_CODEC_INCAPABLE;
|
||||
}
|
||||
|
||||
if (frame_size) {
|
||||
if (ctx->frame_workers) {
|
||||
VP9Worker *const worker = ctx->frame_workers;
|
||||
FrameWorkerData *const frame_worker_data =
|
||||
(FrameWorkerData *)worker->data1;
|
||||
const VP9_COMMON *const cm = &frame_worker_data->pbi->common;
|
||||
frame_size[0] = cm->width;
|
||||
frame_size[1] = cm->height;
|
||||
return VPX_CODEC_OK;
|
||||
} else {
|
||||
return VPX_CODEC_ERROR;
|
||||
}
|
||||
} else {
|
||||
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 *);
|
||||
@ -1027,6 +1054,7 @@ static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
|
||||
{VP9_GET_REFERENCE, ctrl_get_reference},
|
||||
{VP9D_GET_DISPLAY_SIZE, ctrl_get_display_size},
|
||||
{VP9D_GET_BIT_DEPTH, ctrl_get_bit_depth},
|
||||
{VP9D_GET_FRAME_SIZE, ctrl_get_frame_size},
|
||||
|
||||
{ -1, NULL},
|
||||
};
|
||||
|
10
vpx/vp8dx.h
10
vpx/vp8dx.h
@ -76,7 +76,14 @@ enum vp8_dec_control_id {
|
||||
VPXD_SET_DECRYPTOR,
|
||||
VP8D_SET_DECRYPTOR = VPXD_SET_DECRYPTOR,
|
||||
|
||||
/** control function to get the display dimensions for the current frame. */
|
||||
/** control function to get the dimensions that the current frame is decoded
|
||||
* at. This may be different to the intended display size for the frame as
|
||||
* specified in the wrapper or frame header (see VP9D_GET_DISPLAY_SIZE). */
|
||||
VP9D_GET_FRAME_SIZE,
|
||||
|
||||
/** control function to get the current frame's intended display dimensions
|
||||
* (as specified in the wrapper or frame header). This may be different to
|
||||
* the decoded dimensions of this frame (see VP9D_GET_FRAME_SIZE). */
|
||||
VP9D_GET_DISPLAY_SIZE,
|
||||
|
||||
/** control function to get the bit depth of the stream. */
|
||||
@ -140,6 +147,7 @@ VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *)
|
||||
VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *)
|
||||
VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *)
|
||||
VPX_CTRL_USE_TYPE(VP9D_GET_BIT_DEPTH, unsigned int *)
|
||||
VPX_CTRL_USE_TYPE(VP9D_GET_FRAME_SIZE, int *)
|
||||
VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
|
||||
|
||||
/*! @} - end defgroup vp8_decoder */
|
||||
|
Loading…
x
Reference in New Issue
Block a user