From 2268db2cd052674fde55c7d48b7a5098ce89b4ba Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Thu, 3 Sep 2015 13:44:14 +0200 Subject: lavu: Drop the {minus,plus}1 suffix from AVComponentDescriptor fields The new fields can be accessed directly and are more intelligible. Signed-off-by: Vittorio Giovara --- libavcodec/hevc.c | 2 +- libavcodec/hevc_refs.c | 2 +- libavcodec/imgconvert.c | 2 +- libavcodec/libopenjpegdec.c | 10 +++++----- libavcodec/libopenjpegenc.c | 4 ++-- libavcodec/libx265.c | 4 ++-- libavcodec/pnmenc.c | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index f17c313b83..a802e1e4ac 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -2620,7 +2620,7 @@ static int verify_md5(HEVCContext *s, AVFrame *frame) if (!desc) return AVERROR(EINVAL); - pixel_shift = desc->comp[0].depth_minus1 > 7; + pixel_shift = desc->comp[0].depth > 8; av_log(s->avctx, AV_LOG_DEBUG, "Verifying checksum for frame with POC %d: ", s->poc); diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 7901b9eafb..b51f2594a1 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -198,7 +198,7 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush) if (!desc) return AVERROR_BUG; - pixel_shift = desc->comp[0].depth_minus1 > 7; + pixel_shift = desc->comp[0].depth > 8; ret = av_frame_ref(out, frame->frame); ff_hevc_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT); diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index c9bf6a938a..53e7df810a 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -67,7 +67,7 @@ int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, return 0; for (i = 0; i < nb_components; i++) - if (src_desc->comp[i].depth_minus1 > dst_desc->comp[i].depth_minus1) + if (src_desc->comp[i].depth > dst_desc->comp[i].depth) loss |= FF_LOSS_DEPTH; if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w || diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 3da6eeceb2..401ea9b801 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -94,22 +94,22 @@ static int libopenjpeg_matches_pix_fmt(const opj_image_t *img, switch (desc->nb_components) { case 4: match = match && - desc->comp[3].depth_minus1 + 1 >= img->comps[3].prec && + desc->comp[3].depth >= img->comps[3].prec && 1 == img->comps[3].dx && 1 == img->comps[3].dy; case 3: match = match && - desc->comp[2].depth_minus1 + 1 >= img->comps[2].prec && + desc->comp[2].depth >= 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 && - desc->comp[1].depth_minus1 + 1 >= img->comps[1].prec && + desc->comp[1].depth >= 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 && - desc->comp[0].depth_minus1 + 1 >= img->comps[0].prec && + desc->comp[0].depth >= img->comps[0].prec && 1 == img->comps[0].dx && 1 == img->comps[0].dy; default: @@ -365,7 +365,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, } desc = av_pix_fmt_desc_get(avctx->pix_fmt); - pixel_size = desc->comp[0].step_minus1 + 1; + pixel_size = desc->comp[0].step; ispacked = libopenjpeg_ispacked(avctx->pix_fmt); switch (pixel_size) { diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 58aa3cf5fc..d1af0210e3 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -131,8 +131,8 @@ static opj_image_t *libopenjpeg_create_image(AVCodecContext *avctx, } for (i = 0; i < numcomps; i++) { - cmptparm[i].prec = desc->comp[i].depth_minus1 + 1; - cmptparm[i].bpp = desc->comp[i].depth_minus1 + 1; + cmptparm[i].prec = desc->comp[i].depth; + cmptparm[i].bpp = desc->comp[i].depth; cmptparm[i].sgnd = 0; cmptparm[i].dx = sub_dx[i]; cmptparm[i].dy = sub_dy[i]; diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 11ffccf986..f5d3d0f3c0 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -78,7 +78,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) { libx265Context *ctx = avctx->priv_data; - ctx->api = x265_api_get(av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth_minus1 + 1); + ctx->api = x265_api_get(av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth); if (!ctx->api) ctx->api = x265_api_get(0); @@ -261,7 +261,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, } x265pic.pts = pic->pts; - x265pic.bitDepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth_minus1 + 1; + x265pic.bitDepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth; x265pic.sliceType = pic->pict_type == AV_PICTURE_TYPE_I ? X265_TYPE_I : pic->pict_type == AV_PICTURE_TYPE_P ? X265_TYPE_P : diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c index 055aff44e8..791176a11c 100644 --- a/libavcodec/pnmenc.c +++ b/libavcodec/pnmenc.c @@ -83,7 +83,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, "P%c\n%d %d\n", c, avctx->width, h1); bytestream += strlen(bytestream); if (avctx->pix_fmt != AV_PIX_FMT_MONOWHITE) { - int maxdepth = (1 << (av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth_minus1 + 1)) - 1; + int maxdepth = (1 << av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth) - 1; snprintf(bytestream, bytestream_end - bytestream, "%d\n", maxdepth); bytestream += strlen(bytestream); -- cgit v1.2.3