summaryrefslogtreecommitdiff
path: root/libavcodec/libopenjpegdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-10-06 13:29:37 +0200
committerAnton Khirnov <anton@khirnov.net>2012-10-12 12:45:39 +0200
commit50ba57e0ce63d9904269ea0728936a0c79f8bfb5 (patch)
tree9afffc3a86a692d3cf454ed883e835af7d0a3a4f /libavcodec/libopenjpegdec.c
parent9953ff3cd844eb5f6d8dfce98cad94b78a0fc7dc (diff)
downloadffmpeg-50ba57e0ce63d9904269ea0728936a0c79f8bfb5.tar.gz
lavc: do not use av_pix_fmt_descriptors directly.
Diffstat (limited to 'libavcodec/libopenjpegdec.c')
-rw-r--r--libavcodec/libopenjpegdec.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index bdadcd3385..f9cf7e724a 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -75,32 +75,32 @@ typedef struct {
static int libopenjpeg_matches_pix_fmt(const opj_image_t *img,
enum AVPixelFormat pix_fmt)
{
- AVPixFmtDescriptor des = av_pix_fmt_descriptors[pix_fmt];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int match = 1;
- if (des.nb_components != img->numcomps) {
+ if (desc->nb_components != img->numcomps) {
return 0;
}
- switch (des.nb_components) {
+ switch (desc->nb_components) {
case 4:
match = match &&
- des.comp[3].depth_minus1 + 1 >= img->comps[3].prec &&
+ desc->comp[3].depth_minus1 + 1 >= img->comps[3].prec &&
1 == img->comps[3].dx &&
1 == img->comps[3].dy;
case 3:
match = match &&
- des.comp[2].depth_minus1 + 1 >= img->comps[2].prec &&
- 1 << des.log2_chroma_w == img->comps[2].dx &&
- 1 << des.log2_chroma_h == img->comps[2].dy;
+ desc->comp[2].depth_minus1 + 1 >= img->comps[2].prec &&
+ 1 << desc->log2_chroma_w == img->comps[2].dx &&
+ 1 << desc->log2_chroma_h == img->comps[2].dy;
case 2:
match = match &&
- des.comp[1].depth_minus1 + 1 >= img->comps[1].prec &&
- 1 << des.log2_chroma_w == img->comps[1].dx &&
- 1 << des.log2_chroma_h == img->comps[1].dy;
+ desc->comp[1].depth_minus1 + 1 >= img->comps[1].prec &&
+ 1 << desc->log2_chroma_w == img->comps[1].dx &&
+ 1 << desc->log2_chroma_h == img->comps[1].dy;
case 1:
match = match &&
- des.comp[0].depth_minus1 + 1 >= img->comps[0].prec &&
+ desc->comp[0].depth_minus1 + 1 >= img->comps[0].prec &&
1 == img->comps[0].dx &&
1 == img->comps[0].dy;
default:
@@ -146,14 +146,15 @@ static enum AVPixelFormat libopenjpeg_guess_pix_fmt(const opj_image_t *image)
static inline int libopenjpeg_ispacked(enum AVPixelFormat pix_fmt)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int i, component_plane;
if (pix_fmt == AV_PIX_FMT_GRAY16)
return 0;
- component_plane = av_pix_fmt_descriptors[pix_fmt].comp[0].plane;
- for (i = 1; i < av_pix_fmt_descriptors[pix_fmt].nb_components; i++) {
- if (component_plane != av_pix_fmt_descriptors[pix_fmt].comp[i].plane)
+ component_plane = desc->comp[0].plane;
+ for (i = 1; i < desc->nb_components; i++) {
+ if (component_plane != desc->comp[i].plane)
return 0;
}
return 1;
@@ -259,6 +260,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
int buf_size = avpkt->size;
LibOpenJPEGContext *ctx = avctx->priv_data;
AVFrame *picture = &ctx->image, *output = data;
+ const AVPixFmtDescriptor *desc;
opj_dinfo_t *dec;
opj_cio_t *stream;
opj_image_t *image;
@@ -373,8 +375,8 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
goto done;
}
- pixel_size =
- av_pix_fmt_descriptors[avctx->pix_fmt].comp[0].step_minus1 + 1;
+ desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ pixel_size = desc->comp[0].step_minus1 + 1;
ispacked = libopenjpeg_ispacked(avctx->pix_fmt);
switch (pixel_size) {