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);
68 case VPX_IMG_FMT_I420:
71 #if CONFIG_LIBVPX_VP9_DECODER
72 case VPX_IMG_FMT_I422:
75 #if VPX_IMAGE_ABI_VERSION >= 3
76 case VPX_IMG_FMT_I440:
80 case VPX_IMG_FMT_I444:
83 #ifdef VPX_IMG_FMT_HIGHBITDEPTH
84 case VPX_IMG_FMT_I42016:
85 if (img->bit_depth == 10) {
88 }
else if (img->bit_depth == 12) {
94 case VPX_IMG_FMT_I42216:
95 if (img->bit_depth == 10) {
98 }
else if (img->bit_depth == 12) {
104 #if VPX_IMAGE_ABI_VERSION >= 3
105 case VPX_IMG_FMT_I44016:
106 if (img->bit_depth == 10) {
109 }
else if (img->bit_depth == 12) {
116 case VPX_IMG_FMT_I44416:
117 if (img->bit_depth == 10) {
120 }
else if (img->bit_depth == 12) {
138 const void *iter =
NULL;
139 struct vpx_image *
img;
144 const char *error = vpx_codec_error(&ctx->
decoder);
145 const char *detail = vpx_codec_error_detail(&ctx->
decoder);
154 if ((img = vpx_codec_get_frame(&ctx->
decoder, &iter))) {
156 #ifdef VPX_IMG_FMT_HIGHBITDEPTH
158 img->fmt, img->bit_depth);
166 if ((
int) img->d_w != avctx->
width || (
int) img->d_h != avctx->
height) {
176 img->stride, avctx->
pix_fmt, img->d_w, img->d_h);
185 vpx_codec_destroy(&ctx->
decoder);
189 #if CONFIG_LIBVPX_VP8_DECODER
192 return vpx_init(avctx, &vpx_codec_vp8_dx_algo);
195 AVCodec ff_libvpx_vp8_decoder = {
208 #if CONFIG_LIBVPX_VP9_DECODER
211 return vpx_init(avctx, &vpx_codec_vp9_dx_algo);
214 AVCodec ff_libvpx_vp9_decoder = {
215 .
name =
"libvpx-vp9",
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
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
static av_cold int init(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
static av_cold void init_static_data(void)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_VERBOSE
Detailed information.
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
#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. ...
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
const char * name
Name of the codec implementation.
Libavcodec external API header.
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.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static av_cold int vp8_free(AVCodecContext *avctx)
static const chunk_decoder decoder[8]
int width
picture width / height.
static av_cold int vpx_init(AVCodecContext *avctx, const struct vpx_codec_iface *iface)
#define CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
static int vp8_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
#define AV_LOG_INFO
Standard information.
av_cold void ff_vp9_init_static(AVCodec *codec)
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.
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp8)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
common internal api header.
common internal and external API header
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
This structure stores compressed data.