26 #define VPX_CODEC_DISABLE_COMPAT 1
27 #include <vpx/vpx_decoder.h>
28 #include <vpx/vp8dx.h>
36 typedef struct VP8DecoderContext {
41 const struct vpx_codec_iface *iface)
44 struct vpx_codec_dec_cfg deccfg = {
52 if (vpx_codec_dec_init(&ctx->
decoder, iface, &deccfg, 0) != VPX_CODEC_OK) {
53 const char *error = vpx_codec_error(&ctx->
decoder);
67 case VPX_IMG_FMT_I420:
70 #if CONFIG_LIBVPX_VP9_DECODER
71 case VPX_IMG_FMT_I422:
74 case VPX_IMG_FMT_I444:
77 #ifdef VPX_IMG_FMT_HIGHBITDEPTH
78 case VPX_IMG_FMT_I42016:
79 if (img->bit_depth == 10) {
82 }
else if (img->bit_depth == 12) {
88 case VPX_IMG_FMT_I42216:
89 if (img->bit_depth == 10) {
92 }
else if (img->bit_depth == 12) {
98 case VPX_IMG_FMT_I44416:
99 if (img->bit_depth == 10) {
102 }
else if (img->bit_depth == 12) {
120 const void *iter =
NULL;
121 struct vpx_image *
img;
126 const char *error = vpx_codec_error(&ctx->
decoder);
127 const char *detail = vpx_codec_error_detail(&ctx->
decoder);
136 if ((img = vpx_codec_get_frame(&ctx->
decoder, &iter))) {
138 #ifdef VPX_IMG_FMT_HIGHBITDEPTH
140 img->fmt, img->bit_depth);
148 if ((
int) img->d_w != avctx->
width || (
int) img->d_h != avctx->
height) {
158 img->stride, avctx->
pix_fmt, img->d_w, img->d_h);
167 vpx_codec_destroy(&ctx->
decoder);
171 #if CONFIG_LIBVPX_VP8_DECODER
174 return vpx_init(avctx, &vpx_codec_vp8_dx_algo);
177 AVCodec ff_libvpx_vp8_decoder = {
190 #if CONFIG_LIBVPX_VP9_DECODER
193 return vpx_init(avctx, &vpx_codec_vp9_dx_algo);
196 AVCodec ff_libvpx_vp9_decoder = {
197 .
name =
"libvpx-vp9",