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 --- libswscale/output.c | 4 ++-- libswscale/swscale.c | 7 +++---- libswscale/swscale_internal.h | 4 ++-- libswscale/swscale_unscaled.c | 12 ++++++------ libswscale/utils.c | 4 ++-- 5 files changed, 15 insertions(+), 16 deletions(-) (limited to 'libswscale') diff --git a/libswscale/output.c b/libswscale/output.c index 1670f4a2b9..1466f0a2fc 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -1279,7 +1279,7 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter, int i; int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc; uint16_t **dest16 = (uint16_t**)dest; - int SH = 22 + 7 - desc->comp[0].depth_minus1; + int SH = 22 + 8 - desc->comp[0].depth; for (i = 0; i < dstW; i++) { int j; @@ -1366,7 +1366,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c; } else if (is9_OR_10BPS(dstFormat)) { - if (desc->comp[0].depth_minus1 == 8) { + 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 { diff --git a/libswscale/swscale.c b/libswscale/swscale.c index f6427bfb55..2f9cb1b453 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -91,7 +91,7 @@ static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, int i; int32_t *dst = (int32_t *) _dst; const uint16_t *src = (const uint16_t *) _src; - int bits = desc->comp[0].depth_minus1; + int bits = desc->comp[0].depth - 1; int sh = bits - 4; for (i = 0; i < dstW; i++) { @@ -114,7 +114,7 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat); int i; const uint16_t *src = (const uint16_t *) _src; - int sh = desc->comp[0].depth_minus1; + int sh = desc->comp[0].depth - 1; for (i = 0; i < dstW; i++) { int j; @@ -699,8 +699,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], if (is9_OR_10BPS(dstFormat)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); fill_plane9or10(dst[3], dstStride[3], length, height, lastDstY, - 255, desc->comp[3].depth_minus1 + 1, - isBE(dstFormat)); + 255, desc->comp[3].depth, isBE(dstFormat)); } else fillPlane(dst[3], dstStride[3], length, height, lastDstY, 255); } diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index fdaaeeb67f..4d921cde47 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -562,14 +562,14 @@ static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); av_assert0(desc); - return desc->comp[0].depth_minus1 == 15; + return desc->comp[0].depth == 16; } static av_always_inline int is9_OR_10BPS(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); av_assert0(desc); - return desc->comp[0].depth_minus1 == 8 || desc->comp[0].depth_minus1 == 9; + return desc->comp[0].depth == 9 || desc->comp[0].depth == 10; } static av_always_inline int isBE(enum AVPixelFormat pix_fmt) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 699aa60701..39ae5cf640 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -816,15 +816,15 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], if (is9_OR_10BPS(c->dstFormat)) { fill_plane9or10(dst[plane], dstStride[plane], length, height, y, val, - desc_dst->comp[plane].depth_minus1 + 1, + desc_dst->comp[plane].depth, isBE(c->dstFormat)); } else fillPlane(dst[plane], dstStride[plane], length, height, y, val); } else { if (is9_OR_10BPS(c->srcFormat)) { - const int src_depth = desc_src->comp[plane].depth_minus1 + 1; - const int dst_depth = desc_dst->comp[plane].depth_minus1 + 1; + const int src_depth = desc_src->comp[plane].depth; + const int dst_depth = desc_dst->comp[plane].depth; const uint16_t *srcPtr2 = (const uint16_t *) srcPtr; if (is16BPS(c->dstFormat)) { @@ -915,7 +915,7 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], } } } else if (is9_OR_10BPS(c->dstFormat)) { - const int dst_depth = desc_dst->comp[plane].depth_minus1 + 1; + const int dst_depth = desc_dst->comp[plane].depth; uint16_t *dstPtr2 = (uint16_t *) dstPtr; if (is16BPS(c->srcFormat)) { @@ -1006,7 +1006,7 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], } else { if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) length *= 2; - else if (!desc_src->comp[0].depth_minus1) + else if (desc_src->comp[0].depth == 1) length >>= 3; // monowhite/black for (i = 0; i < height; i++) { memcpy(dstPtr, srcPtr, length); @@ -1087,7 +1087,7 @@ void ff_get_unscaled_swscale(SwsContext *c) if (srcFormat == AV_PIX_FMT_GBRP && isPlanar(srcFormat) && isByteRGB(dstFormat)) c->swscale = planarRgbToRgbWrapper; - if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth_minus1 == 7 && + if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth == 8 && isPackedRGB(srcFormat) && dstFormat == AV_PIX_FMT_GBRP) c->swscale = rgbToPlanarRgbWrapper; diff --git a/libswscale/utils.c b/libswscale/utils.c index f5b251136a..5406e19927 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1039,10 +1039,10 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, } } - c->srcBpc = 1 + desc_src->comp[0].depth_minus1; + c->srcBpc = desc_src->comp[0].depth; if (c->srcBpc < 8) c->srcBpc = 8; - c->dstBpc = 1 + desc_dst->comp[0].depth_minus1; + c->dstBpc = desc_dst->comp[0].depth; if (c->dstBpc < 8) c->dstBpc = 8; if (c->dstBpc == 16) -- cgit v1.2.3