Go to the documentation of this file.
26 #define VPX_CODEC_DISABLE_COMPAT 1
27 #include <vpx/vpx_decoder.h>
28 #include <vpx/vp8dx.h>
45 const struct vpx_codec_iface *iface,
49 struct vpx_codec_dec_cfg deccfg = {
56 if (vpx_codec_dec_init(
57 is_alpha_decoder ? &
ctx->decoder_alpha : &
ctx->decoder,
58 iface, &deccfg, 0) != VPX_CODEC_OK) {
59 const char *
error = vpx_codec_error(&
ctx->decoder);
70 int has_alpha_channel)
76 #if VPX_IMAGE_ABI_VERSION >= 4
86 case VPX_IMG_FMT_I420:
92 #if CONFIG_LIBVPX_VP9_DECODER
93 case VPX_IMG_FMT_I422:
97 case VPX_IMG_FMT_I440:
101 case VPX_IMG_FMT_I444:
106 case VPX_IMG_FMT_I42016:
108 if (
img->bit_depth == 10) {
111 }
else if (
img->bit_depth == 12) {
117 case VPX_IMG_FMT_I42216:
119 if (
img->bit_depth == 10) {
122 }
else if (
img->bit_depth == 12) {
128 case VPX_IMG_FMT_I44016:
130 if (
img->bit_depth == 10) {
133 }
else if (
img->bit_depth == 12) {
139 case VPX_IMG_FMT_I44416:
141 if (
img->bit_depth == 10) {
145 }
else if (
img->bit_depth == 12) {
161 if (vpx_codec_decode(
decoder,
data, data_sz,
NULL, 0) != VPX_CODEC_OK) {
163 const char *detail = vpx_codec_error_detail(
decoder);
180 const void *iter =
NULL;
181 const void *iter_alpha =
NULL;
182 struct vpx_image *
img, *img_alpha;
185 int side_data_size = 0;
194 if (side_data_size > 1) {
195 const uint64_t additional_id =
AV_RB64(side_data);
198 if (additional_id == 1) {
199 if (!
ctx->has_alpha_channel) {
200 ctx->has_alpha_channel = 1;
202 #
if CONFIG_LIBVPX_VP8_DECODER && CONFIG_LIBVPX_VP9_DECODER
204 &vpx_codec_vp8_dx_algo : &vpx_codec_vp9_dx_algo,
205 #elif CONFIG_LIBVPX_VP8_DECODER
206 &vpx_codec_vp8_dx_algo,
208 &vpx_codec_vp9_dx_algo,
221 if ((
img = vpx_codec_get_frame(&
ctx->decoder, &iter)) &&
222 (!
ctx->has_alpha_channel ||
223 (img_alpha = vpx_codec_get_frame(&
ctx->decoder_alpha, &iter_alpha)))) {
235 img->fmt,
img->bit_depth);
253 ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] :
NULL;
254 linesizes[0] =
img->stride[VPX_PLANE_Y];
255 linesizes[1] =
img->stride[VPX_PLANE_U];
256 linesizes[2] =
img->stride[VPX_PLANE_V];
258 ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0;
269 vpx_codec_destroy(&
ctx->decoder);
270 if (
ctx->has_alpha_channel)
271 vpx_codec_destroy(&
ctx->decoder_alpha);
275 #if CONFIG_LIBVPX_VP8_DECODER
278 return vpx_init(avctx, &vpx_codec_vp8_dx_algo, 0);
286 .priv_data_size =
sizeof(VPxContext),
291 .wrapper_name =
"libvpx",
295 #if CONFIG_LIBVPX_VP9_DECODER
298 return vpx_init(avctx, &vpx_codec_vp9_dx_algo, 0);
302 .
name =
"libvpx-vp9",
306 .priv_data_size =
sizeof(VPxContext),
313 .wrapper_name =
"libvpx",
AVCodec ff_libvpx_vp8_decoder
static av_cold int init(AVCodecContext *avctx)
static av_cold int vp9_init(AVFormatContext *ctx, int st_index, PayloadContext *data)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVColorSpace colorspace
YUV colorspace type.
static av_cold int vpx_init(AVCodecContext *avctx, const struct vpx_codec_iface *iface, int is_alpha_decoder)
This structure describes decoded (raw) audio or video data.
@ AVCOL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
#define AV_PIX_FMT_YUV420P10
#define AV_LOG_VERBOSE
Detailed information.
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
static const chunk_decoder decoder[8]
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
#define AV_PIX_FMT_GBRP10
static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img, int has_alpha_channel)
#define AV_PIX_FMT_YUV444P10
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
av_cold void ff_vp9_init_static(AVCodec *codec)
#define AV_PIX_FMT_YUV440P10
static av_cold int vpx_free(AVCodecContext *avctx)
#define AV_PIX_FMT_YUV422P10
static void error(const char *err)
struct vpx_codec_ctx decoder
#define AV_CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static const struct @314 planes[]
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV444P12
#define AVERROR_EXTERNAL
Generic error in an external library.
#define AV_LOG_INFO
Standard information.
@ AVCOL_SPC_SMPTE240M
functionally identical to above
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
#define AV_PIX_FMT_GBRP12
AVColorSpace
YUV colorspace type.
const char * name
Name of the codec implementation.
struct vpx_codec_ctx decoder_alpha
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AVCOL_RANGE_MPEG
the normal 219*2^(n-8) "MPEG" YUV ranges
#define AV_PIX_FMT_YUV420P12
main external API structure.
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 int vpx_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const AVProfile profiles[]
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static int decode_frame(AVCodecContext *avctx, vpx_codec_ctx_t *decoder, uint8_t *data, uint32_t data_sz)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
AVCodec ff_libvpx_vp9_decoder
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 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.
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
This structure stores compressed data.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_PIX_FMT_YUV440P12
static av_cold int vp8_init(AVFormatContext *s, int st_index, PayloadContext *vp8)
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
AVColorRange
MPEG vs JPEG YUV range.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
const AVProfile ff_vp9_profiles[]