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 const void *iter =
NULL;
68 struct vpx_image *img;
73 const char *error = vpx_codec_error(&ctx->
decoder);
74 const char *detail = vpx_codec_error_detail(&ctx->
decoder);
83 if ((img = vpx_codec_get_frame(&ctx->
decoder, &iter))) {
91 if ((
int) img->d_w != avctx->
width || (
int) img->d_h != avctx->
height) {
101 img->stride, avctx->
pix_fmt, img->d_w, img->d_h);
102 #if VPX_IMAGE_ABI_VERSION >= 4 103 switch (img->range) {
104 case VPX_CR_STUDIO_RANGE:
107 case VPX_CR_FULL_RANGE:
120 vpx_codec_destroy(&ctx->
decoder);
124 #if CONFIG_LIBVPX_VP8_DECODER 127 return vpx_init(avctx, &vpx_codec_vp8_dx_algo);
130 AVCodec ff_libvpx_vp8_decoder = {
143 #if CONFIG_LIBVPX_VP9_DECODER 146 return vpx_init(avctx, &vpx_codec_vp9_dx_algo);
149 AVCodec ff_libvpx_vp9_decoder = {
150 .
name =
"libvpx-vp9",
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
struct vpx_codec_ctx decoder
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img)
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVColorRange color_range
const char * name
Name of the codec implementation.
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
static av_cold int vp8_free(AVCodecContext *avctx)
static const chunk_decoder decoder[8]
int width
picture width / height.
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
static av_cold int vpx_init(AVCodecContext *avctx, const struct vpx_codec_iface *iface)
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() ...
the normal 2^n-1 "JPEG" YUV ranges
#define AV_LOG_INFO
Standard information.
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static av_cold int vp9_init(AVFormatContext *ctx, int st_index, PayloadContext *data)
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
the normal 219*2^(n-8) "MPEG" YUV ranges
static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp8)
common internal api header.
common internal and external API header
static av_cold int init(AVCodecParserContext *s)
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.