Commit 4ada428a authored by Martin Vignali's avatar Martin Vignali Committed by James Almer

avcodec: remove remaining uses of avcodec_get_chroma_sub_sample

Replace them with av_pix_fmt_get_chroma_sub_sample.
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 7d1c79f5
......@@ -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");
......
......@@ -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)) {
......
......@@ -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();
......
......@@ -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
......
......@@ -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];
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment