From 5d8e836d0ec3bcaabf5bc2020210a1bc61975922 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Tue, 8 Sep 2015 17:10:48 +0200 Subject: [PATCH] Replace all remaining occurances of step/depth_minus1 and offset_plus1 --- ffprobe.c | 2 +- libavcodec/dpxenc.c | 2 +- libavcodec/ffv1dec.c | 2 +- libavcodec/ffv1enc.c | 2 +- libavcodec/huffyuvenc.c | 2 +- libavcodec/jpeg2000dec.c | 8 ++++---- libavcodec/libopenjpegdec.c | 4 ++-- libavcodec/mjpegdec.c | 2 +- libavcodec/tiffenc.c | 2 +- libavcodec/utils.c | 4 ++-- libavcodec/x86/lossless_videodsp_init.c | 2 +- libavdevice/opengl_enc.c | 4 ++-- libavfilter/drawutils.c | 8 ++++---- libavfilter/vf_atadenoise.c | 2 +- libavfilter/vf_blend.c | 2 +- libavfilter/vf_boxblur.c | 4 ++-- libavfilter/vf_colorkey.c | 2 +- libavfilter/vf_colorlevels.c | 2 +- libavfilter/vf_cropdetect.c | 2 +- libavfilter/vf_deband.c | 10 +++++----- libavfilter/vf_decimate.c | 2 +- libavfilter/vf_extractplanes.c | 8 ++++---- libavfilter/vf_histogram.c | 18 +++++++++--------- libavfilter/vf_idet.c | 2 +- libavfilter/vf_lut.c | 18 +++++++++--------- libavfilter/vf_mergeplanes.c | 8 ++++---- libavfilter/vf_noise.c | 2 +- libavfilter/vf_psnr.c | 12 ++++++------ libavfilter/vf_spp.c | 4 ++-- libavfilter/vf_swapuv.c | 4 ++-- libavfilter/vf_vectorscope.c | 2 +- libavfilter/vf_waveform.c | 2 +- libavfilter/x86/vf_yadif_init.c | 2 +- libavformat/img2enc.c | 2 +- libavformat/mxfenc.c | 2 +- libavutil/pixdesc.c | 20 ++++++++++---------- libswscale/alphablend.c | 16 ++++++++-------- libswscale/output.c | 6 +++--- libswscale/swscale.c | 4 ++-- libswscale/swscale_unscaled.c | 4 ++-- libswscale/utils.c | 2 +- libswscale/x86/swscale.c | 2 +- 42 files changed, 105 insertions(+), 105 deletions(-) diff --git a/ffprobe.c b/ffprobe.c index 3e5324e36b..4328b61f0e 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -2722,7 +2722,7 @@ static void ffprobe_show_pixel_formats(WriterContext *w) for (i = 0; i < pixdesc->nb_components; i++) { writer_print_section_header(w, SECTION_ID_PIXEL_FORMAT_COMPONENT); print_int("index", i + 1); - print_int("bit_depth", pixdesc->comp[i].depth_minus1 + 1); + print_int("bit_depth", pixdesc->comp[i].depth); writer_print_section_footer(w); } writer_print_section_footer(w); diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c index 0d1dd1d510..9f3cbbe977 100644 --- a/libavcodec/dpxenc.c +++ b/libavcodec/dpxenc.c @@ -39,7 +39,7 @@ static av_cold int encode_init(AVCodecContext *avctx) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); s->big_endian = !!(desc->flags & AV_PIX_FMT_FLAG_BE); - s->bits_per_component = desc->comp[0].depth_minus1 + 1; + s->bits_per_component = desc->comp[0].depth; s->num_components = desc->nb_components; s->descriptor = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) ? 51 : 50; s->planar = !!(desc->flags & AV_PIX_FMT_FLAG_PLANAR); diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 162e41bcbf..557b1a0994 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -359,7 +359,7 @@ static int decode_slice(AVCodecContext *c, void *arg) FFV1Context *fs = *(void **)arg; FFV1Context *f = fs->avctx->priv_data; int width, height, x, y, ret; - const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step_minus1 + 1; + const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step; AVFrame * const p = f->cur; int i, si; diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 35d88ca244..265ced1172 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -1123,7 +1123,7 @@ static int encode_slice(AVCodecContext *c, void *arg) int x = fs->slice_x; int y = fs->slice_y; const AVFrame *const p = f->picture.f; - const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step_minus1 + 1; + const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step; int ret; RangeCoder c_bak = fs->c; const uint8_t *planes[3] = {p->data[0] + ps*x + y*p->linesize[0], diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 65b165aaa0..40044a4483 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -238,7 +238,7 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif - s->bps = desc->comp[0].depth_minus1 + 1; + s->bps = desc->comp[0].depth; s->yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2; s->chroma = desc->nb_components > 2; s->alpha = !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA); diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index a414dc1ebf..ed286c6d8c 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -201,20 +201,20 @@ static int pix_fmt_match(enum AVPixelFormat pix_fmt, int components, switch (components) { case 4: - match = match && desc->comp[3].depth_minus1 + 1 >= bpc && + match = match && desc->comp[3].depth >= bpc && (log2_chroma_wh >> 14 & 3) == 0 && (log2_chroma_wh >> 12 & 3) == 0; case 3: - match = match && desc->comp[2].depth_minus1 + 1 >= bpc && + match = match && desc->comp[2].depth >= bpc && (log2_chroma_wh >> 10 & 3) == desc->log2_chroma_w && (log2_chroma_wh >> 8 & 3) == desc->log2_chroma_h; case 2: - match = match && desc->comp[1].depth_minus1 + 1 >= bpc && + match = match && desc->comp[1].depth >= bpc && (log2_chroma_wh >> 6 & 3) == desc->log2_chroma_w && (log2_chroma_wh >> 4 & 3) == desc->log2_chroma_h; case 1: - match = match && desc->comp[0].depth_minus1 + 1 >= bpc && + match = match && desc->comp[0].depth >= bpc && (log2_chroma_wh >> 2 & 3) == 0 && (log2_chroma_wh & 3) == 0 && (desc->flags & AV_PIX_FMT_FLAG_PAL) == pal8 * AV_PIX_FMT_FLAG_PAL; diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 01ff48ce32..8539e2c9bd 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -204,7 +204,7 @@ static inline void libopenjpeg_copy_to_packed16(AVFrame *picture, opj_image_t *i int index, x, y, c; int adjust[4]; for (x = 0; x < image->numcomps; x++) - adjust[x] = FFMAX(FFMIN(desc->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0) + desc->comp[x].shift; + adjust[x] = FFMAX(FFMIN(desc->comp[x].depth - image->comps[x].prec, 8), 0) + desc->comp[x].shift; for (y = 0; y < picture->height; y++) { index = y * picture->width; @@ -241,7 +241,7 @@ static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) { int index, x, y; int adjust[4]; for (x = 0; x < image->numcomps; x++) - adjust[x] = FFMAX(FFMIN(desc->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0) + desc->comp[x].shift; + adjust[x] = FFMAX(FFMIN(desc->comp[x].depth - image->comps[x].prec, 8), 0) + desc->comp[x].shift; for (index = 0; index < image->numcomps; index++) { comp_data = image->comps[index].data; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 818f8c9300..396f05ed1e 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2158,7 +2158,7 @@ fail: return ret; the_end: - is16bit = av_pix_fmt_desc_get(s->avctx->pix_fmt)->comp[0].step_minus1; + is16bit = av_pix_fmt_desc_get(s->avctx->pix_fmt)->comp[0].step > 1; if (AV_RB32(s->upscale_h)) { int p; diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index fbbea1a7e1..3d37d2e084 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -311,7 +311,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } for (i = 0; i < s->bpp_tab_size; i++) - bpp_tab[i] = desc->comp[i].depth_minus1 + 1; + bpp_tab[i] = desc->comp[i].depth; if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE || diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 5f3faf0e17..81bc2151ef 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -700,7 +700,7 @@ void avpriv_color_frame(AVFrame *frame, const int c[4]) int bytes = is_chroma ? FF_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width; int height = is_chroma ? FF_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height; for (y = 0; y < height; y++) { - if (desc->comp[0].depth_minus1 >= 8) { + if (desc->comp[0].depth >= 9) { for (x = 0; xpix_fmt == AV_PIX_FMT_NONE ? "none" : av_get_pix_fmt_name(enc->pix_fmt)); if (enc->bits_per_raw_sample && enc->pix_fmt != AV_PIX_FMT_NONE && - enc->bits_per_raw_sample <= av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth_minus1) + enc->bits_per_raw_sample < av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth) av_strlcatf(detail, sizeof(detail), "%d bpc, ", enc->bits_per_raw_sample); if (enc->color_range != AVCOL_RANGE_UNSPECIFIED) av_strlcatf(detail, sizeof(detail), "%s, ", diff --git a/libavcodec/x86/lossless_videodsp_init.c b/libavcodec/x86/lossless_videodsp_init.c index 6589024a1a..b0fbcfef8f 100644 --- a/libavcodec/x86/lossless_videodsp_init.c +++ b/libavcodec/x86/lossless_videodsp_init.c @@ -42,7 +42,7 @@ void ff_llviddsp_init_x86(LLVidDSPContext *c, AVCodecContext *avctx) c->diff_int16 = ff_diff_int16_mmx; } - if (EXTERNAL_MMXEXT(cpu_flags) && pix_desc->comp[0].depth_minus1<15) { + if (EXTERNAL_MMXEXT(cpu_flags) && pix_desc->comp[0].depth<16) { c->add_hfyu_median_pred_int16 = ff_add_hfyu_median_pred_int16_mmxext; c->sub_hfyu_median_pred_int16 = ff_sub_hfyu_median_pred_int16_mmxext; } diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c index 434ae97a42..851b94735d 100644 --- a/libavdevice/opengl_enc.c +++ b/libavdevice/opengl_enc.c @@ -733,8 +733,8 @@ static av_cold void opengl_fill_color_map(OpenGLContext *opengl) return; #define FILL_COMPONENT(i) { \ - shift = desc->comp[i].depth_minus1 >> 3; \ - opengl->color_map[(i << 2) + ((desc->comp[i].offset_plus1 - 1) >> shift)] = 1.0; \ + shift = (desc->comp[i].depth - 1) >> 3; \ + opengl->color_map[(i << 2) + (desc->comp[i].offset >> shift)] = 1.0; \ } memset(opengl->color_map, 0, sizeof(opengl->color_map)); diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c index 5a82b10cd6..b65d57cfae 100644 --- a/libavfilter/drawutils.c +++ b/libavfilter/drawutils.c @@ -172,15 +172,15 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) for (i = 0; i < desc->nb_components; i++) { c = &desc->comp[i]; /* for now, only 8-bits formats */ - if (c->depth_minus1 != 8 - 1) + if (c->depth != 8) return AVERROR(ENOSYS); if (c->plane >= MAX_PLANES) return AVERROR(ENOSYS); /* strange interleaving */ if (pixelstep[c->plane] != 0 && - pixelstep[c->plane] != c->step_minus1 + 1) + pixelstep[c->plane] != c->step) return AVERROR(ENOSYS); - pixelstep[c->plane] = c->step_minus1 + 1; + pixelstep[c->plane] = c->step; if (pixelstep[c->plane] >= 8) return AVERROR(ENOSYS); nb_planes = FFMAX(nb_planes, c->plane + 1); @@ -196,7 +196,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) draw->vsub[1] = draw->vsub[2] = draw->vsub_max = desc->log2_chroma_h; for (i = 0; i < ((desc->nb_components - 1) | 1); i++) draw->comp_mask[desc->comp[i].plane] |= - 1 << (desc->comp[i].offset_plus1 - 1); + 1 << desc->comp[i].offset; return 0; } diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c index a3c623f6ff..9ce0250471 100755 --- a/libavfilter/vf_atadenoise.c +++ b/libavfilter/vf_atadenoise.c @@ -269,7 +269,7 @@ static int config_input(AVFilterLink *inlink) s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); s->planewidth[0] = s->planewidth[3] = inlink->w; - depth = desc->comp[0].depth_minus1 + 1; + depth = desc->comp[0].depth; if (depth == 8) s->filter_slice = filter_slice8; else diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index 2a33ce156d..5901ffaa74 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -464,7 +464,7 @@ static int config_output(AVFilterLink *outlink) s->hsub = pix_desc->log2_chroma_w; s->vsub = pix_desc->log2_chroma_h; - is_16bit = pix_desc->comp[0].depth_minus1 == 15; + is_16bit = pix_desc->comp[0].depth == 16; s->nb_planes = av_pix_fmt_count_planes(toplink->format); if (s->tblend) diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c index 17db949bc6..0e9bafd700 100644 --- a/libavfilter/vf_boxblur.c +++ b/libavfilter/vf_boxblur.c @@ -124,7 +124,7 @@ static int query_formats(AVFilterContext *ctx) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt); if (!(desc->flags & (AV_PIX_FMT_FLAG_HWACCEL | AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_PAL)) && (desc->flags & AV_PIX_FMT_FLAG_PLANAR || desc->nb_components == 1) && - (!(desc->flags & AV_PIX_FMT_FLAG_BE) == !HAVE_BIGENDIAN || desc->comp[0].depth_minus1 == 7)) + (!(desc->flags & AV_PIX_FMT_FLAG_BE) == !HAVE_BIGENDIAN || desc->comp[0].depth == 8)) ff_add_format(&formats, fmt); } @@ -351,7 +351,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) int w[4] = { inlink->w, cw, cw, inlink->w }; int h[4] = { in->height, ch, ch, in->height }; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); - const int depth = desc->comp[0].depth_minus1 + 1; + const int depth = desc->comp[0].depth; const int pixsize = (depth+7)/8; out = ff_get_video_buffer(outlink, outlink->w, outlink->h); diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c index 19e39ec6aa..993da8b10f 100644 --- a/libavfilter/vf_colorkey.c +++ b/libavfilter/vf_colorkey.c @@ -103,7 +103,7 @@ static av_cold int config_output(AVFilterLink *outlink) outlink->time_base = avctx->inputs[0]->time_base; for (i = 0; i < 4; ++i) - ctx->co[i] = desc->comp[i].offset_plus1 - 1; + ctx->co[i] = desc->comp[i].offset; return 0; } diff --git a/libavfilter/vf_colorlevels.c b/libavfilter/vf_colorlevels.c index 7157c9138a..cb3314b8ac 100644 --- a/libavfilter/vf_colorlevels.c +++ b/libavfilter/vf_colorlevels.c @@ -97,7 +97,7 @@ static int config_input(AVFilterLink *inlink) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); s->nb_comp = desc->nb_components; - s->bpp = (desc->comp[0].depth_minus1 + 1) >> 3; + s->bpp = desc->comp[0].depth >> 3; s->step = (av_get_padded_bits_per_pixel(desc) >> 3) / s->bpp; s->linesize = inlink->w * s->step; ff_fill_rgba_map(s->rgba_map, inlink->format); diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index 7fa965160f..d45637777f 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -144,7 +144,7 @@ static int config_input(AVFilterLink *inlink) av_image_fill_max_pixsteps(s->max_pixsteps, NULL, desc); if (s->limit < 1.0) - s->limit *= (1 << (desc->comp[0].depth_minus1 + 1)) - 1; + s->limit *= (1 << desc->comp[0].depth) - 1; s->x1 = inlink->w - 1; s->y1 = inlink->h - 1; diff --git a/libavfilter/vf_deband.c b/libavfilter/vf_deband.c index 5de3db171d..36897218fe 100644 --- a/libavfilter/vf_deband.c +++ b/libavfilter/vf_deband.c @@ -223,12 +223,12 @@ static int config_input(AVFilterLink *inlink) s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); s->planewidth[0] = s->planewidth[3] = inlink->w; - s->deband = desc->comp[0].depth_minus1 > 7 ? deband_16_c : deband_8_c; + s->deband = desc->comp[0].depth > 8 ? deband_16_c : deband_8_c; - s->thr[0] = ((1 << (desc->comp[0].depth_minus1 + 1)) - 1) * s->threshold[0]; - s->thr[1] = ((1 << (desc->comp[1].depth_minus1 + 1)) - 1) * s->threshold[1]; - s->thr[2] = ((1 << (desc->comp[2].depth_minus1 + 1)) - 1) * s->threshold[2]; - s->thr[3] = ((1 << (desc->comp[3].depth_minus1 + 1)) - 1) * s->threshold[3]; + s->thr[0] = ((1 << desc->comp[0].depth) - 1) * s->threshold[0]; + s->thr[1] = ((1 << desc->comp[1].depth) - 1) * s->threshold[1]; + s->thr[2] = ((1 << desc->comp[2].depth) - 1) * s->threshold[2]; + s->thr[3] = ((1 << desc->comp[3].depth) - 1) * s->threshold[3]; s->x_pos = av_malloc(s->planewidth[0] * s->planeheight[0] * sizeof(*s->x_pos)); s->y_pos = av_malloc(s->planewidth[0] * s->planeheight[0] * sizeof(*s->y_pos)); diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index 70357ea8e2..d352665c0e 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -239,7 +239,7 @@ static int config_input(AVFilterLink *inlink) dm->hsub = pix_desc->log2_chroma_w; dm->vsub = pix_desc->log2_chroma_h; - dm->depth = pix_desc->comp[0].depth_minus1 + 1; + dm->depth = pix_desc->comp[0].depth; max_value = (1 << dm->depth) - 1; dm->scthresh = (int64_t)(((int64_t)max_value * w * h * dm->scthresh_flt) / 100); dm->dupthresh = (int64_t)(((int64_t)max_value * dm->blockx * dm->blocky * dm->dupthresh_flt) / 100); diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c index 1018e92f25..47a174856e 100644 --- a/libavfilter/vf_extractplanes.c +++ b/libavfilter/vf_extractplanes.c @@ -111,17 +111,17 @@ static int query_formats(AVFilterContext *ctx) avff = ctx->inputs[0]->in_formats; desc = av_pix_fmt_desc_get(avff->formats[0]); - depth = desc->comp[0].depth_minus1; + depth = desc->comp[0].depth; be = desc->flags & AV_PIX_FMT_FLAG_BE; for (i = 1; i < avff->nb_formats; i++) { desc = av_pix_fmt_desc_get(avff->formats[i]); - if (depth != desc->comp[0].depth_minus1 || + if (depth != desc->comp[0].depth || be != (desc->flags & AV_PIX_FMT_FLAG_BE)) { return AVERROR(EAGAIN); } } - if (depth == 7) + if (depth == 8) out_pixfmts = out8_pixfmts; else if (be) out_pixfmts = out16be_pixfmts; @@ -152,7 +152,7 @@ static int config_input(AVFilterLink *inlink) if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0) return ret; - s->depth = (desc->comp[0].depth_minus1 + 1) >> 3; + s->depth = desc->comp[0].depth >> 3; s->step = av_get_padded_bits_per_pixel(desc) >> 3; s->is_packed = !(desc->flags & AV_PIX_FMT_FLAG_PLANAR) && (desc->nb_components > 1); diff --git a/libavfilter/vf_histogram.c b/libavfilter/vf_histogram.c index 443cbda660..d8e935a28e 100644 --- a/libavfilter/vf_histogram.c +++ b/libavfilter/vf_histogram.c @@ -177,25 +177,25 @@ static int query_formats(AVFilterContext *ctx) avff = ctx->inputs[0]->in_formats; desc = av_pix_fmt_desc_get(avff->formats[0]); rgb = desc->flags & AV_PIX_FMT_FLAG_RGB; - bits = desc->comp[0].depth_minus1; + bits = desc->comp[0].depth; for (i = 1; i < avff->nb_formats; i++) { desc = av_pix_fmt_desc_get(avff->formats[i]); if ((rgb != (desc->flags & AV_PIX_FMT_FLAG_RGB)) || - (bits != desc->comp[0].depth_minus1)) + (bits != desc->comp[0].depth)) return AVERROR(EAGAIN); } - if (rgb && bits == 7) + if (rgb && bits == 8) out_pix_fmts = levels_out_rgb8_pix_fmts; - else if (rgb && bits == 8) - out_pix_fmts = levels_out_rgb9_pix_fmts; else if (rgb && bits == 9) + out_pix_fmts = levels_out_rgb9_pix_fmts; + else if (rgb && bits == 10) out_pix_fmts = levels_out_rgb10_pix_fmts; - else if (bits == 7) - out_pix_fmts = levels_out_yuv8_pix_fmts; else if (bits == 8) + out_pix_fmts = levels_out_yuv8_pix_fmts; + else if (bits == 9) out_pix_fmts = levels_out_yuv9_pix_fmts; - else // if (bits == 9) + else // if (bits == 10) out_pix_fmts = levels_out_yuv10_pix_fmts; ff_formats_ref(ff_make_format_list(out_pix_fmts), &ctx->outputs[0]->in_formats); @@ -227,7 +227,7 @@ static int config_input(AVFilterLink *inlink) h->desc = av_pix_fmt_desc_get(inlink->format); h->ncomp = h->desc->nb_components; - h->histogram_size = 1 << (h->desc->comp[0].depth_minus1 + 1); + h->histogram_size = 1 << h->desc->comp[0].depth; h->mult = h->histogram_size / 256; switch (inlink->format) { diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c index eb1303a310..711ba6e218 100644 --- a/libavfilter/vf_idet.c +++ b/libavfilter/vf_idet.c @@ -275,7 +275,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref) if (!idet->csp) idet->csp = av_pix_fmt_desc_get(link->format); - if (idet->csp->comp[0].depth_minus1 / 8 == 1){ + if (idet->csp->comp[0].depth > 8){ idet->filter_line = (ff_idet_filter_func)ff_idet_filter_line_c_16bit; if (ARCH_X86) ff_idet_init_x86(idet, 1); diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 3f0524daaf..c81575aecf 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -213,7 +213,7 @@ static int config_props(AVFilterLink *inlink) s->var_values[VAR_W] = inlink->w; s->var_values[VAR_H] = inlink->h; - s->is_16bit = desc->comp[0].depth_minus1 > 7; + s->is_16bit = desc->comp[0].depth > 8; switch (inlink->format) { case AV_PIX_FMT_YUV410P: @@ -251,14 +251,14 @@ static int config_props(AVFilterLink *inlink) case AV_PIX_FMT_YUVA420P16LE: case AV_PIX_FMT_YUVA422P16LE: case AV_PIX_FMT_YUVA444P16LE: - min[Y] = 16 * (1 << (desc->comp[0].depth_minus1 - 7)); - min[U] = 16 * (1 << (desc->comp[1].depth_minus1 - 7)); - min[V] = 16 * (1 << (desc->comp[2].depth_minus1 - 7)); + min[Y] = 16 * (1 << (desc->comp[0].depth - 8)); + min[U] = 16 * (1 << (desc->comp[1].depth - 8)); + min[V] = 16 * (1 << (desc->comp[2].depth - 8)); min[A] = 0; - max[Y] = 235 * (1 << (desc->comp[0].depth_minus1 - 7)); - max[U] = 240 * (1 << (desc->comp[1].depth_minus1 - 7)); - max[V] = 240 * (1 << (desc->comp[2].depth_minus1 - 7)); - max[A] = (1 << (desc->comp[3].depth_minus1 + 1)) - 1; + max[Y] = 235 * (1 << (desc->comp[0].depth - 8)); + max[U] = 240 * (1 << (desc->comp[1].depth - 8)); + max[V] = 240 * (1 << (desc->comp[2].depth - 8)); + max[A] = (1 << desc->comp[3].depth) - 1; break; default: min[0] = min[1] = min[2] = min[3] = 0; @@ -294,7 +294,7 @@ static int config_props(AVFilterLink *inlink) s->var_values[VAR_MAXVAL] = max[color]; s->var_values[VAR_MINVAL] = min[color]; - for (val = 0; val < (1 << (desc->comp[0].depth_minus1 + 1)); val++) { + for (val = 0; val < (1 << desc->comp[0].depth); val++) { s->var_values[VAR_VAL] = val; s->var_values[VAR_CLIPVAL] = av_clip(val, min[color], max[color]); s->var_values[VAR_NEGVAL] = diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c index 734327eacc..ea796be10f 100644 --- a/libavfilter/vf_mergeplanes.c +++ b/libavfilter/vf_mergeplanes.c @@ -121,7 +121,7 @@ static int query_formats(AVFilterContext *ctx) s->outdesc = av_pix_fmt_desc_get(s->out_fmt); for (i = 0; av_pix_fmt_desc_get(i); i++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i); - if (desc->comp[0].depth_minus1 == s->outdesc->comp[0].depth_minus1 && + if (desc->comp[0].depth == s->outdesc->comp[0].depth && av_pix_fmt_count_planes(i) == desc->nb_components) ff_add_format(&formats, i); } @@ -227,7 +227,7 @@ static int config_output(AVFilterLink *outlink) inputp->nb_planes = av_pix_fmt_count_planes(inlink->format); for (j = 0; j < inputp->nb_planes; j++) - inputp->depth[j] = indesc->comp[j].depth_minus1 + 1; + inputp->depth[j] = indesc->comp[j].depth; in[i].time_base = inlink->time_base; in[i].sync = 1; @@ -245,10 +245,10 @@ static int config_output(AVFilterLink *outlink) input, plane); goto fail; } - if (s->outdesc->comp[i].depth_minus1 + 1 != inputp->depth[plane]) { + if (s->outdesc->comp[i].depth != inputp->depth[plane]) { av_log(ctx, AV_LOG_ERROR, "output plane %d depth %d does not " "match input %d plane %d depth %d\n", - i, s->outdesc->comp[i].depth_minus1 + 1, + i, s->outdesc->comp[i].depth, input, plane, inputp->depth[plane]); goto fail; } diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c index 861ac09087..c658bba8c1 100644 --- a/libavfilter/vf_noise.c +++ b/libavfilter/vf_noise.c @@ -137,7 +137,7 @@ static int query_formats(AVFilterContext *ctx) for (fmt = 0; av_pix_fmt_desc_get(fmt); fmt++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt); - if (desc->flags & AV_PIX_FMT_FLAG_PLANAR && !((desc->comp[0].depth_minus1 + 1) & 7)) + if (desc->flags & AV_PIX_FMT_FLAG_PLANAR && !(desc->comp[0].depth & 7)) ff_add_format(&formats, fmt); } diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index 3c1dc81a7a..a01b2c12ce 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -251,10 +251,10 @@ static int config_input_ref(AVFilterLink *inlink) return AVERROR(EINVAL); } - s->max[0] = (1 << (desc->comp[0].depth_minus1 + 1)) - 1; - s->max[1] = (1 << (desc->comp[1].depth_minus1 + 1)) - 1; - s->max[2] = (1 << (desc->comp[2].depth_minus1 + 1)) - 1; - s->max[3] = (1 << (desc->comp[3].depth_minus1 + 1)) - 1; + s->max[0] = (1 << desc->comp[0].depth) - 1; + s->max[1] = (1 << desc->comp[1].depth) - 1; + s->max[2] = (1 << desc->comp[2].depth) - 1; + s->max[3] = (1 << desc->comp[3].depth) - 1; s->is_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0; s->comps[0] = s->is_rgb ? 'r' : 'y' ; @@ -274,9 +274,9 @@ static int config_input_ref(AVFilterLink *inlink) s->average_max += s->max[j] * s->planeweight[j]; } - s->dsp.sse_line = desc->comp[0].depth_minus1 > 7 ? sse_line_16bit : sse_line_8bit; + s->dsp.sse_line = desc->comp[0].depth > 8 ? sse_line_16bit : sse_line_8bit; if (ARCH_X86) - ff_psnr_init_x86(&s->dsp, desc->comp[0].depth_minus1 + 1); + ff_psnr_init_x86(&s->dsp, desc->comp[0].depth); return 0; } diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c index 990fea3de7..9d99130c30 100644 --- a/libavfilter/vf_spp.c +++ b/libavfilter/vf_spp.c @@ -331,7 +331,7 @@ static int config_input(AVFilterLink *inlink) SPPContext *s = inlink->dst->priv; const int h = FFALIGN(inlink->h + 16, 16); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); - const int bps = desc->comp[0].depth_minus1 + 1; + const int bps = desc->comp[0].depth; av_opt_set_int(s->dct, "bits_per_sample", bps, 0); avcodec_dct_init(s->dct); @@ -359,7 +359,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) int qp_stride = 0; const int8_t *qp_table = NULL; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); - const int depth = desc->comp[0].depth_minus1 + 1; + const int depth = desc->comp[0].depth; /* if we are not in a constant user quantizer mode and we don't want to use * the quantizers from the B-frames (B-frames often have a higher QP), we diff --git a/libavfilter/vf_swapuv.c b/libavfilter/vf_swapuv.c index 632e31c75e..b450e6fb4c 100644 --- a/libavfilter/vf_swapuv.c +++ b/libavfilter/vf_swapuv.c @@ -56,10 +56,10 @@ static int is_planar_yuv(const AVPixFmtDescriptor *desc) if (desc->flags & ~(AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA) || desc->nb_components < 3 || - (desc->comp[1].depth_minus1 != desc->comp[2].depth_minus1)) + (desc->comp[1].depth != desc->comp[2].depth)) return 0; for (i = 0; i < desc->nb_components; i++) { - if (desc->comp[i].offset_plus1 != 1 || + if (desc->comp[i].offset != 0 || desc->comp[i].shift != 0 || desc->comp[i].plane != i) return 0; diff --git a/libavfilter/vf_vectorscope.c b/libavfilter/vf_vectorscope.c index 42052e6d8f..e99b304bd0 100644 --- a/libavfilter/vf_vectorscope.c +++ b/libavfilter/vf_vectorscope.c @@ -187,7 +187,7 @@ static int config_input(AVFilterLink *inlink) static int config_output(AVFilterLink *outlink) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format); - const int depth = desc->comp[0].depth_minus1 + 1; + const int depth = desc->comp[0].depth; VectorscopeContext *s = outlink->src->priv; s->intensity = s->fintensity * ((1 << depth) - 1); diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c index c6be694962..b2468c11cc 100644 --- a/libavfilter/vf_waveform.c +++ b/libavfilter/vf_waveform.c @@ -1172,7 +1172,7 @@ static int config_input(AVFilterLink *inlink) s->desc = av_pix_fmt_desc_get(inlink->format); s->ncomp = s->desc->nb_components; - s->bits = s->desc->comp[0].depth_minus1 + 1; + s->bits = s->desc->comp[0].depth; s->max = 1 << s->bits; s->intensity = s->fintensity * (s->max - 1); diff --git a/libavfilter/x86/vf_yadif_init.c b/libavfilter/x86/vf_yadif_init.c index 1460a642c3..c36a2d010e 100644 --- a/libavfilter/x86/vf_yadif_init.c +++ b/libavfilter/x86/vf_yadif_init.c @@ -62,7 +62,7 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif) { int cpu_flags = av_get_cpu_flags(); int bit_depth = (!yadif->csp) ? 8 - : yadif->csp->comp[0].depth_minus1 + 1; + : yadif->csp->comp[0].depth; if (bit_depth >= 15) { #if ARCH_X86_32 diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index 5dd4c77c37..48454fe1d2 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -117,7 +117,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) if (img->split_planes) { int ysize = codec->width * codec->height; int usize = FF_CEIL_RSHIFT(codec->width, desc->log2_chroma_w) * FF_CEIL_RSHIFT(codec->height, desc->log2_chroma_h); - if (desc->comp[0].depth_minus1 >= 8) { + if (desc->comp[0].depth >= 9) { ysize *= 2; usize *= 2; } diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 142c8708d9..546d983aef 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2058,7 +2058,7 @@ static int mxf_write_header(AVFormatContext *s) sc->color_siting = 0xFF; if (pix_desc) { - sc->component_depth = pix_desc->comp[0].depth_minus1 + 1; + sc->component_depth = pix_desc->comp[0].depth; sc->h_chroma_sub_sample = 1 << pix_desc->log2_chroma_w; } switch (ff_choose_chroma_location(s, st)) { diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 39a28efa3d..f4ada7bdeb 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2103,7 +2103,7 @@ int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc) for (c = 0; c < pixdesc->nb_components; c++) { const AVComponentDescriptor *comp = &pixdesc->comp[c]; int s = c == 1 || c == 2 ? 0 : log2_pixels; - steps[comp->plane] = (comp->step_minus1 + 1) << s; + steps[comp->plane] = comp->step << s; } for (c = 0; c < 4; c++) bits += steps[c]; @@ -2207,19 +2207,19 @@ void ff_check_pixfmt_descriptors(void){ for (j=0; jcomp); j++) { const AVComponentDescriptor *c = &d->comp[j]; if(j>=d->nb_components) { - av_assert0(!c->plane && !c->step_minus1 && !c->offset_plus1 && !c->shift && !c->depth_minus1); + av_assert0(!c->plane && !c->step && !c->offset && !c->shift && !c->depth); continue; } if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) { - av_assert0(c->step_minus1 >= c->depth_minus1); + av_assert0(c->step >= c->depth); } else { - av_assert0(8*(c->step_minus1+1) >= c->depth_minus1+1); + av_assert0(8*c->step >= c->depth); } if (!strncmp(d->name, "bayer_", 6)) continue; av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0); av_assert0(tmp[0] == 0 && tmp[1] == 0); - tmp[0] = tmp[1] = (1<<(c->depth_minus1 + 1)) - 1; + tmp[0] = tmp[1] = (1<depth) - 1; av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2); } } @@ -2286,8 +2286,8 @@ static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt) *min = INT_MAX, *max = -INT_MAX; for (i = 0; i < desc->nb_components; i++) { - *min = FFMIN(desc->comp[i].depth_minus1+1, *min); - *max = FFMAX(desc->comp[i].depth_minus1+1, *max); + *min = FFMIN(desc->comp[i].depth, *min); + *max = FFMAX(desc->comp[i].depth, *max); } return 0; } @@ -2325,8 +2325,8 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components); for (i = 0; i < nb_components; i++) { - int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : dst_desc->comp[i].depth_minus1; - if (src_desc->comp[i].depth_minus1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) { + int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1); + if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) { loss |= FF_LOSS_DEPTH; score -= 65536 >> depth_minus1; } @@ -2376,7 +2376,7 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, break; } if(loss & FF_LOSS_COLORSPACE) - score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth_minus1, src_desc->comp[0].depth_minus1); + score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1); if (dst_color == FF_COLOR_GRAY && src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) { diff --git a/libswscale/alphablend.c b/libswscale/alphablend.c index b9b809b702..1f63493bdc 100644 --- a/libswscale/alphablend.c +++ b/libswscale/alphablend.c @@ -28,20 +28,20 @@ int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[], int nb_components = desc->nb_components; int plane, x, y; int plane_count = isGray(c->srcFormat) ? 1 : 3; - int sixteen_bits = desc->comp[0].depth_minus1 >= 8; - unsigned off = 1<comp[0].depth_minus1; - unsigned shift = desc->comp[0].depth_minus1 + 1; + int sixteen_bits = desc->comp[0].depth >= 9; + unsigned off = 1<<(desc->comp[0].depth - 1); + unsigned shift = desc->comp[0].depth; unsigned max = (1<alphablend == SWS_ALPHA_BLEND_CHECKERBOARD) { - a = (1<comp[0].depth_minus1)/2; - b = 3*(1<comp[0].depth_minus1)/2; + a = (1<<(desc->comp[0].depth - 1))/2; + b = 3*(1<<(desc->comp[0].depth-1))/2; } - target_table[0][plane] = plane && !(desc->flags & AV_PIX_FMT_FLAG_RGB) ? 1<comp[0].depth_minus1 : a; - target_table[1][plane] = plane && !(desc->flags & AV_PIX_FMT_FLAG_RGB) ? 1<comp[0].depth_minus1 : b; + target_table[0][plane] = plane && !(desc->flags & AV_PIX_FMT_FLAG_RGB) ? 1<<(desc->comp[0].depth - 1) : a; + target_table[1][plane] = plane && !(desc->flags & AV_PIX_FMT_FLAG_RGB) ? 1<<(desc->comp[0].depth - 1) : b; } av_assert0(plane_count == nb_components - 1); @@ -125,7 +125,7 @@ int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[], } } } else { - int alpha_pos = desc->comp[plane_count].offset_plus1 - 1; + int alpha_pos = desc->comp[plane_count].offset; int w = c->srcW; for (y = srcSliceY; y < srcSliceH; y++) { if (sixteen_bits) { diff --git a/libswscale/output.c b/libswscale/output.c index 16cfd75c5a..3188baadf9 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2076,13 +2076,13 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, if (desc->comp[0].depth == 9) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c; - } else if (desc->comp[0].depth_minus1 == 9) { + } else if (desc->comp[0].depth == 10) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c; - } else if (desc->comp[0].depth_minus1 == 11) { + } else if (desc->comp[0].depth == 12) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c; - } else if (desc->comp[0].depth_minus1 == 13) { + } else if (desc->comp[0].depth == 14) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c; } else diff --git a/libswscale/swscale.c b/libswscale/swscale.c index b7d3d6a3a2..8d71abbbbc 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -90,7 +90,7 @@ static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, int bits = desc->comp[0].depth - 1; int sh = bits - 4; - if((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth_minus1<15) + if((isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) sh= 9; for (i = 0; i < dstW; i++) { @@ -116,7 +116,7 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, int sh = desc->comp[0].depth - 1; if(sh<15) - sh= isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : desc->comp[0].depth_minus1; + sh= isAnyRGB(c->srcFormat) || c->srcFormat==AV_PIX_FMT_PAL8 ? 13 : (desc->comp[0].depth - 1); for (i = 0; i < dstW; i++) { int j; diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 8f57b2a3d2..f387f52df4 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -554,7 +554,7 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *src[], int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] }; const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat); const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat); - int bpc = dst_format->comp[0].depth_minus1 + 1; + int bpc = dst_format->comp[0].depth; int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA; int swap = 0; if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) || @@ -725,7 +725,7 @@ static int planarRgb16ToRgb16Wrapper(SwsContext *c, const uint8_t *src[], int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] }; const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat); const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat); - int bits_per_sample = src_format->comp[0].depth_minus1 + 1; + int bits_per_sample = src_format->comp[0].depth; int swap = 0; if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) || !HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE) diff --git a/libswscale/utils.c b/libswscale/utils.c index b2ce49601b..354ec055f2 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1691,7 +1691,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, // try to avoid drawing green stuff between the right end and the stride end for (i = 0; i < c->vChrBufSize; i++) - if(desc_dst->comp[0].depth_minus1 == 15){ + if(desc_dst->comp[0].depth == 16){ av_assert0(c->dstBpc > 14); for(j=0; jchrUPixBuf[i]))[j] = 1<<18; diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index fe5690d4a3..66ac7d5e56 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -434,7 +434,7 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c) } else if (c->srcBpc == 12) { \ hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \ ff_hscale12to19_ ## filtersize ## _ ## opt1; \ - } else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth_minus1<15)) { \ + } else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth<16)) { \ hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \ ff_hscale14to19_ ## filtersize ## _ ## opt1; \ } else { /* c->srcBpc == 16 */ \