26 #define VPX_CODEC_DISABLE_COMPAT 1
27 #include <vpx/vpx_decoder.h>
28 #include <vpx/vp8dx.h>
41 const struct vpx_codec_iface *iface = &vpx_codec_vp8_dx_algo;
42 struct vpx_codec_dec_cfg deccfg = {
50 if (vpx_codec_dec_init(&ctx->decoder, iface, &deccfg, 0) != VPX_CODEC_OK) {
51 const char *error = vpx_codec_error(&ctx->decoder);
66 const void *iter =
NULL;
67 struct vpx_image *img;
69 if (vpx_codec_decode(&ctx->decoder, avpkt->
data, avpkt->
size,
NULL, 0) !=
71 const char *error = vpx_codec_error(&ctx->decoder);
72 const char *detail = vpx_codec_error_detail(&ctx->decoder);
81 if ((img = vpx_codec_get_frame(&ctx->decoder, &iter))) {
82 if (img->fmt != VPX_IMG_FMT_I420) {
88 if ((
int) img->d_w != avctx->
width || (
int) img->d_h != avctx->
height) {
95 picture->
data[0] = img->planes[0];
96 picture->
data[1] = img->planes[1];
97 picture->
data[2] = img->planes[2];
99 picture->
linesize[0] = img->stride[0];
100 picture->
linesize[1] = img->stride[1];
101 picture->
linesize[2] = img->stride[2];
111 vpx_codec_destroy(&ctx->decoder);
This structure describes decoded (raw) audio or video data.
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
struct vpx_codec_ctx decoder
struct VP8DecoderContext VP8Context
static int init(AVCodecParserContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
#define CODEC_CAP_AUTO_THREADS
static av_cold int vp8_free(AVCodecContext *avctx)
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int width
picture width / height.
static int vp8_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
static av_cold int vp8_init(AVCodecContext *avctx)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVCodec ff_libvpx_decoder
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal and external API header
#define AVERROR_INVALIDDATA
This structure stores compressed data.