aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2017-11-06 22:39:16 +0100
committerJames Almer <jamrial@gmail.com>2017-11-06 19:13:03 -0300
commit4ada428aae2f4ab42c6cebc0d7591c0e62db6fe2 (patch)
tree64ff90f19d094203be823c34caf0da5e8390eb61
parent7d1c79f533e0c80cbcda60d3cbd8216551a1bac5 (diff)
downloadffmpeg-4ada428aae2f4ab42c6cebc0d7591c0e62db6fe2.tar.gz
avcodec: remove remaining uses of avcodec_get_chroma_sub_sample
Replace them with av_pix_fmt_get_chroma_sub_sample. Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavcodec/dirac.c6
-rw-r--r--libavcodec/ffv1enc.c5
-rw-r--r--libavcodec/j2kenc.c7
-rw-r--r--libavcodec/libtheoraenc.c4
-rw-r--r--libavcodec/mjpegdec.c15
-rw-r--r--libavcodec/mpegvideo.c16
-rw-r--r--libavcodec/vc2enc.c6
-rw-r--r--libavcodec/vp3.c4
8 files changed, 46 insertions, 17 deletions
diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index 027ce79a2e..d5870d6c00 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -147,6 +147,7 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
unsigned luma_depth = 8, luma_offset = 16;
int idx;
int chroma_x_shift, chroma_y_shift;
+ int ret;
/* [DIRAC_STD] 10.3.2 Frame size. frame_size(video_params) */
/* [DIRAC_STD] custom_dimensions_flag */
@@ -269,7 +270,10 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
return AVERROR_INVALIDDATA;
dsh->pix_fmt = dirac_pix_fmt[dsh->chroma_format][dsh->pixel_range_index-2];
- avcodec_get_chroma_sub_sample(dsh->pix_fmt, &chroma_x_shift, &chroma_y_shift);
+ ret = av_pix_fmt_get_chroma_sub_sample(dsh->pix_fmt, &chroma_x_shift, &chroma_y_shift);
+ if (ret)
+ return ret;
+
if ((dsh->width % (1<<chroma_x_shift)) || (dsh->height % (1<<chroma_y_shift))) {
if (log_ctx)
av_log(log_ctx, AV_LOG_ERROR, "Dimensions must be an integer multiple of the chroma subsampling\n");
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index c9a885ebfa..09df4c0c57 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -754,7 +754,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (!s->chroma_planes && s->version > 3)
s->plane_count--;
- avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
+ ret = av_pix_fmt_get_chroma_sub_sample (avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
+ if (ret)
+ return ret;
+
s->picture_number = 0;
if (avctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) {
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index c8d3861732..2135ece540 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -69,6 +69,7 @@
#include "bytestream.h"
#include "jpeg2000.h"
#include "libavutil/common.h"
+#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#define NMSEDEC_BITS 7
@@ -1150,8 +1151,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
} else{ // planar YUV
s->planar = 1;
s->ncomponents = 3;
- avcodec_get_chroma_sub_sample(avctx->pix_fmt,
- s->chroma_shift, s->chroma_shift + 1);
+ ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt,
+ s->chroma_shift, s->chroma_shift + 1);
+ if (ret)
+ return ret;
}
ff_jpeg2000_init_tier1_luts();
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index fae55e8f23..d4c39283a6 100644
--- a/libavcodec/libtheoraenc.c
+++ b/libavcodec/libtheoraenc.c
@@ -208,7 +208,9 @@ static av_cold int encode_init(AVCodecContext* avc_context)
av_log(avc_context, AV_LOG_ERROR, "Unsupported pix_fmt\n");
return AVERROR(EINVAL);
}
- avcodec_get_chroma_sub_sample(avc_context->pix_fmt, &h->uv_hshift, &h->uv_vshift);
+ ret = av_pix_fmt_get_chroma_sub_sample(avc_context->pix_fmt, &h->uv_hshift, &h->uv_vshift);
+ if (ret)
+ return ret;
if (avc_context->flags & AV_CODEC_FLAG_QSCALE) {
/* Clip global_quality in QP units to the [0 - 10] range
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index d980ac99a1..e005dd0cd3 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2428,7 +2428,10 @@ the_end:
avctx->pix_fmt == AV_PIX_FMT_GBRP ||
avctx->pix_fmt == AV_PIX_FMT_GBRAP
);
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
+ ret = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
+ if (ret)
+ return ret;
+
av_assert0(s->nb_components == av_pix_fmt_count_planes(s->picture_ptr->format));
for (p = 0; p<s->nb_components; p++) {
uint8_t *line = s->picture_ptr->data[p];
@@ -2487,7 +2490,10 @@ the_end:
avctx->pix_fmt == AV_PIX_FMT_GBRP ||
avctx->pix_fmt == AV_PIX_FMT_GBRAP
);
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
+ ret = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
+ if (ret)
+ return ret;
+
av_assert0(s->nb_components == av_pix_fmt_count_planes(s->picture_ptr->format));
for (p = 0; p < s->nb_components; p++) {
uint8_t *dst;
@@ -2515,7 +2521,10 @@ the_end:
}
if (s->flipped && !s->rgb) {
int j;
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
+ ret = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
+ if (ret)
+ return ret;
+
av_assert0(s->nb_components == av_pix_fmt_count_planes(s->picture_ptr->format));
for (index=0; index<s->nb_components; index++) {
uint8_t *dst = s->picture_ptr->data[index];
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 2f5793b9a4..080e9077fc 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -876,7 +876,7 @@ static void clear_context(MpegEncContext *s)
*/
av_cold int ff_mpv_common_init(MpegEncContext *s)
{
- int i;
+ int i, ret;
int nb_slices = (HAVE_THREADS &&
s->avctx->active_thread_type & FF_THREAD_SLICE) ?
s->avctx->thread_count : 1;
@@ -915,10 +915,11 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
dct_init(s);
/* set chroma shifts */
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,
- &s->chroma_x_shift,
- &s->chroma_y_shift);
-
+ ret = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+ &s->chroma_x_shift,
+ &s->chroma_y_shift);
+ if (ret)
+ return ret;
FF_ALLOCZ_OR_GOTO(s->avctx, s->picture,
MAX_PICTURE_COUNT * sizeof(Picture), fail);
@@ -1452,6 +1453,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
const int mv_stride = (mb_width << mv_sample_log2) +
(avctx->codec->id == AV_CODEC_ID_H264 ? 0 : 1);
int mb_x, mb_y, mbcount = 0;
+ int ret;
/* size is width * height * 2 * 4 where 2 is for directions and 4 is
* for the maximum number of MB (4 MB in case of IS_8x8) */
@@ -1616,7 +1618,9 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
if (low_delay)
*low_delay = 0; // needed to see the vectors without trashing the buffers
- avcodec_get_chroma_sub_sample(avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
+ ret = av_pix_fmt_get_chroma_sub_sample (avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
+ if (ret)
+ return ret;
av_frame_make_writable(pict);
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index 96e27d93ed..fa4ff54a3c 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -1063,7 +1063,7 @@ static av_cold int vc2_encode_init(AVCodecContext *avctx)
{
Plane *p;
SubBand *b;
- int i, j, level, o, shift;
+ int i, j, level, o, shift, ret;
const AVPixFmtDescriptor *fmt = av_pix_fmt_desc_get(avctx->pix_fmt);
const int depth = fmt->comp[0].depth;
VC2EncContext *s = avctx->priv_data;
@@ -1138,7 +1138,9 @@ static av_cold int vc2_encode_init(AVCodecContext *avctx)
}
/* Chroma subsampling */
- avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
+ ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
+ if (ret)
+ return ret;
/* Bit depth and color range index */
if (depth == 8 && avctx->color_range == AVCOL_RANGE_JPEG) {
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index f167acf4ee..cf9c57f5fa 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1761,7 +1761,9 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
for (i = 0; i < 3; i++)
s->qps[i] = -1;
- avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
+ ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
+ if (ret)
+ return ret;
s->y_superblock_width = (s->width + 31) / 32;
s->y_superblock_height = (s->height + 31) / 32;