diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-12 15:52:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-12 15:57:28 +0200 |
commit | a9bd51b1e647d7ec0b7661e19b87ade86098b38c (patch) | |
tree | 37682f77a88bc8e09eb97fbc923192292a1abbe4 /libswscale/utils.c | |
parent | a33ed6bc74b6b8ada925c76c4084afcf8870a048 (diff) | |
parent | 9953ff3cd844eb5f6d8dfce98cad94b78a0fc7dc (diff) | |
download | ffmpeg-a9bd51b1e647d7ec0b7661e19b87ade86098b38c.tar.gz |
Merge commit '9953ff3cd844eb5f6d8dfce98cad94b78a0fc7dc'
* commit '9953ff3cd844eb5f6d8dfce98cad94b78a0fc7dc':
mpegvideo: fix indentation
sws: do not use av_pix_fmt_descriptors directly.
Conflicts:
libavcodec/mpegvideo.c
libswscale/swscale_internal.h
libswscale/swscale_unscaled.c
libswscale/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r-- | libswscale/utils.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index 9c839d8dde..f9797b19da 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -197,7 +197,11 @@ extern const int32_t ff_yuv2rgb_coeffs[8][4]; #if FF_API_SWS_FORMAT_NAME const char *sws_format_name(enum AVPixelFormat format) { - return av_get_pix_fmt_name(format); + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format); + if (desc) + return desc->name; + else + return "Unknown format"; } #endif @@ -767,14 +771,17 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, static void getSubSampleFactors(int *h, int *v, enum AVPixelFormat format) { - *h = av_pix_fmt_descriptors[format].log2_chroma_w; - *v = av_pix_fmt_descriptors[format].log2_chroma_h; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format); + *h = desc->log2_chroma_w; + *v = desc->log2_chroma_h; } int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation) { + const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat); + const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat); memcpy(c->srcColorspaceTable, inv_table, sizeof(int) * 4); memcpy(c->dstColorspaceTable, table, sizeof(int) * 4); @@ -786,8 +793,8 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1; - c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[c->dstFormat]); - c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[c->srcFormat]); + c->dstFormatBpp = av_get_bits_per_pixel(desc_dst); + c->srcFormatBpp = av_get_bits_per_pixel(desc_src); ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation); @@ -873,6 +880,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, int flags, cpu_flags; enum AVPixelFormat srcFormat = c->srcFormat; enum AVPixelFormat dstFormat = c->dstFormat; + const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat); + const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat); cpu_flags = av_get_cpu_flags(); flags = c->flags; @@ -935,8 +944,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, c->lumXInc = (((int64_t)srcW << 16) + (dstW >> 1)) / dstW; c->lumYInc = (((int64_t)srcH << 16) + (dstH >> 1)) / dstH; - c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]); - c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]); + c->dstFormatBpp = av_get_bits_per_pixel(desc_dst); + c->srcFormatBpp = av_get_bits_per_pixel(desc_src); c->vRounder = 4 * 0x0001000100010001ULL; usesVFilter = (srcFilter->lumV && srcFilter->lumV->length > 1) || @@ -1015,10 +1024,10 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, } } - c->srcBpc = 1 + av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1; + c->srcBpc = 1 + desc_src->comp[0].depth_minus1; if (c->srcBpc < 8) c->srcBpc = 8; - c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1; + c->dstBpc = 1 + desc_dst->comp[0].depth_minus1; if (c->dstBpc < 8) c->dstBpc = 8; if (isAnyRGB(srcFormat) || srcFormat == AV_PIX_FMT_PAL8) |