aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-10-12 15:13:42 +0000
committerPaul B Mahol <onemda@gmail.com>2012-10-12 15:31:42 +0000
commita51540d81167547f1c7c2b8f545c246711611071 (patch)
treeed001a8c92dbf84c5dcaf0f434cb9ccb4519a27e
parent27ccc82e1bb1b97a85e5fb33b92082267078b4d1 (diff)
downloadffmpeg-a51540d81167547f1c7c2b8f545c246711611071.tar.gz
lavc: do not use av_pix_fmt_descriptors directly
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavcodec/exr.c10
-rw-r--r--libavcodec/ffv1.c3
-rw-r--r--libavcodec/iff.c3
-rw-r--r--libavcodec/targaenc.c2
-rw-r--r--libavcodec/tiffenc.c7
5 files changed, 15 insertions, 10 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 5b4c26db3e..93ae4a63b6 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -230,6 +230,7 @@ static int decode_frame(AVCodecContext *avctx,
unsigned int buf_size = avpkt->size;
const uint8_t *buf_end = buf + buf_size;
+ const AVPixFmtDescriptor *desc;;
EXRContext *const s = avctx->priv_data;
AVFrame *picture = data;
AVFrame *const p = &s->picture;
@@ -494,9 +495,10 @@ static int decode_frame(AVCodecContext *avctx,
avcodec_set_dimensions(avctx, w, h);
}
- bxmin = xmin * 2 * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components;
- axmax = (avctx->width - (xmax + 1)) * 2 * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components;
- out_line_size = avctx->width * 2 * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components;
+ desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ bxmin = xmin * 2 * desc->nb_components;
+ axmax = (avctx->width - (xmax + 1)) * 2 * desc->nb_components;
+ out_line_size = avctx->width * 2 * desc->nb_components;
scan_line_size = xdelta * current_channel_offset;
uncompressed_size = scan_line_size * scan_lines_per_block;
@@ -590,7 +592,7 @@ static int decode_frame(AVCodecContext *avctx,
// Zero out the start if xmin is not 0
memset(ptr_x, 0, bxmin);
- ptr_x += xmin * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components;
+ ptr_x += xmin * desc->nb_components;
if (s->bits_per_color_id == 2) {
// 32-bit
for (x = 0; x < xdelta; x++) {
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index c63a27f8aa..a09644eda4 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -916,6 +916,7 @@ static int sort_stt(FFV1Context *s, uint8_t stt[256]){
static av_cold int encode_init(AVCodecContext *avctx)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
FFV1Context *s = avctx->priv_data;
int i, j, k, m;
@@ -983,7 +984,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUV411P:
case AV_PIX_FMT_YUV410P:
- s->chroma_planes= av_pix_fmt_descriptors[avctx->pix_fmt].nb_components < 3 ? 0 : 1;
+ s->chroma_planes= desc->nb_components < 3 ? 0 : 1;
s->colorspace= 0;
break;
case AV_PIX_FMT_YUVA444P:
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 70f548bf67..3940a0cdae 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -519,7 +519,8 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
}
}
} else if (avctx->codec_tag == MKTAG('D','E','E','P')) {
- int raw_width = avctx->width * (av_get_bits_per_pixel(&av_pix_fmt_descriptors[avctx->pix_fmt]) >> 3);
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ int raw_width = avctx->width * (av_get_bits_per_pixel(desc) >> 3);
int x;
for(y = 0; y < avctx->height && buf < buf_end; y++ ) {
uint8_t *row = &s->frame.data[0][y * s->frame.linesize[0]];
diff --git a/libavcodec/targaenc.c b/libavcodec/targaenc.c
index 4a71f27522..b2c679df80 100644
--- a/libavcodec/targaenc.c
+++ b/libavcodec/targaenc.c
@@ -101,7 +101,7 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
out = pkt->data + 18; /* skip past the header we write */
- avctx->bits_per_coded_sample = av_get_bits_per_pixel(&av_pix_fmt_descriptors[avctx->pix_fmt]);
+ avctx->bits_per_coded_sample = av_get_bits_per_pixel(av_pix_fmt_desc_get(avctx->pix_fmt));
switch(avctx->pix_fmt) {
case AV_PIX_FMT_PAL8: {
int pal_bpp = 24; /* Only write 32bit palette if there is transparency information */
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 8c30ed29dc..c675c55f71 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -239,6 +239,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
const AVFrame *pict, int *got_packet)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
TiffEncoderContext *s = avctx->priv_data;
AVFrame *const p = &s->picture;
int i;
@@ -260,8 +261,8 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
s->subsampling[1] = 1;
avctx->bits_per_coded_sample =
- s->bpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[avctx->pix_fmt]);
- s->bpp_tab_size = av_pix_fmt_descriptors[avctx->pix_fmt].nb_components;
+ s->bpp = av_get_bits_per_pixel(desc);
+ s->bpp_tab_size = desc->nb_components;
switch (avctx->pix_fmt) {
case AV_PIX_FMT_RGBA64LE:
@@ -305,7 +306,7 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
}
for (i = 0; i < s->bpp_tab_size; i++)
- bpp_tab[i] = av_pix_fmt_descriptors[avctx->pix_fmt].comp[i].depth_minus1 + 1;
+ bpp_tab[i] = desc->comp[i].depth_minus1 + 1;
if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE || s->compr == TIFF_LZW)
//best choose for DEFLATE