[FFmpeg-cvslog] swscale: factor ff_sws_init_range_convert() out
Michael Niedermayer
git at videolan.org
Tue Apr 15 01:04:20 CEST 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Apr 14 23:18:21 2014 +0200| [a2f088c0f93c6942fa9756803b99cb7746994d0d] | committer: Michael Niedermayer
swscale: factor ff_sws_init_range_convert() out
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2f088c0f93c6942fa9756803b99cb7746994d0d
---
libswscale/swscale.c | 47 +++++++++++++++++++++++------------------
libswscale/swscale_internal.h | 2 ++
2 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 4762f58..b73a1f2 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -705,6 +705,31 @@ static int swscale(SwsContext *c, const uint8_t *src[],
return dstY - lastDstY;
}
+av_cold void ff_sws_init_range_convert(SwsContext *c)
+{
+ c->lumConvertRange = NULL;
+ c->chrConvertRange = NULL;
+ if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
+ if (c->dstBpc <= 14) {
+ if (c->srcRange) {
+ c->lumConvertRange = lumRangeFromJpeg_c;
+ c->chrConvertRange = chrRangeFromJpeg_c;
+ } else {
+ c->lumConvertRange = lumRangeToJpeg_c;
+ c->chrConvertRange = chrRangeToJpeg_c;
+ }
+ } else {
+ if (c->srcRange) {
+ c->lumConvertRange = lumRangeFromJpeg16_c;
+ c->chrConvertRange = chrRangeFromJpeg16_c;
+ } else {
+ c->lumConvertRange = lumRangeToJpeg16_c;
+ c->chrConvertRange = chrRangeToJpeg16_c;
+ }
+ }
+ }
+}
+
static av_cold void sws_init_swscale(SwsContext *c)
{
enum AVPixelFormat srcFormat = c->srcFormat;
@@ -731,27 +756,7 @@ static av_cold void sws_init_swscale(SwsContext *c)
: hScale16To15_c;
}
- c->lumConvertRange = NULL;
- c->chrConvertRange = NULL;
- if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
- if (c->dstBpc <= 14) {
- if (c->srcRange) {
- c->lumConvertRange = lumRangeFromJpeg_c;
- c->chrConvertRange = chrRangeFromJpeg_c;
- } else {
- c->lumConvertRange = lumRangeToJpeg_c;
- c->chrConvertRange = chrRangeToJpeg_c;
- }
- } else {
- if (c->srcRange) {
- c->lumConvertRange = lumRangeFromJpeg16_c;
- c->chrConvertRange = chrRangeFromJpeg16_c;
- } else {
- c->lumConvertRange = lumRangeToJpeg16_c;
- c->chrConvertRange = chrRangeToJpeg16_c;
- }
- }
- }
+ ff_sws_init_range_convert(c);
if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
srcFormat == AV_PIX_FMT_MONOBLACK || srcFormat == AV_PIX_FMT_MONOWHITE))
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 0b3e687..bb8847d 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -617,6 +617,8 @@ void ff_yuv2rgb_init_tables_ppc(SwsContext *c, const int inv_table[4],
void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,
int lastInLumBuf, int lastInChrBuf);
+av_cold void ff_sws_init_range_convert(SwsContext *c);
+
SwsFunc ff_yuv2rgb_init_x86(SwsContext *c);
SwsFunc ff_yuv2rgb_init_ppc(SwsContext *c);
SwsFunc ff_yuv2rgb_init_bfin(SwsContext *c);
More information about the ffmpeg-cvslog
mailing list