aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Abeni <lucabe72@email.it>2006-09-27 11:41:36 +0000
committerLuca Abeni <lucabe72@email.it>2006-09-27 11:41:36 +0000
commit44cdb42386798e5de010cffa875a9090d2f18717 (patch)
tree3f2e2018b441c78ac52b52f809855e6833cdde8c
parenta2eb288ac7cb4435c02f72928ba208bbed902ceb (diff)
downloadffmpeg-44cdb42386798e5de010cffa875a9090d2f18717.tar.gz
Add support for YUVJ formats
Originally committed as revision 19993 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r--libswscale/swscale.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 8dd0d4fe77..1b649f33d4 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1841,6 +1841,23 @@ int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int
return 0;
}
+static int handle_jpeg(int *format)
+{
+ switch (*format) {
+ case PIX_FMT_YUVJ420P:
+ *format = PIX_FMT_YUV420P;
+ return 1;
+ case PIX_FMT_YUVJ422P:
+ *format = PIX_FMT_YUV422P;
+ return 1;
+ case PIX_FMT_YUVJ444P:
+ *format = PIX_FMT_YUV444P;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param){
@@ -1848,6 +1865,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
int i;
int usesVFilter, usesHFilter;
int unscaled, needsDither;
+ int srcRange, dstRange;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
#if defined(ARCH_X86) || defined(ARCH_X86_64)
if(flags & SWS_CPU_CAPS_MMX)
@@ -1874,6 +1892,9 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
&& (fmt_depth(dstFormat))<24
&& ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat))));
+ srcRange = handle_jpeg(&srcFormat);
+ dstRange = handle_jpeg(&dstFormat);
+
if(!isSupportedIn(srcFormat))
{
MSG_ERR("swScaler: %s is not supported as input format\n", sws_format_name(srcFormat));
@@ -1951,7 +1972,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
- sws_setColorspaceDetails(c, Inverse_Table_6_9[SWS_CS_DEFAULT], 0, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, 0, 0, 1<<16, 1<<16);
+ sws_setColorspaceDetails(c, Inverse_Table_6_9[SWS_CS_DEFAULT], srcRange, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16);
/* unscaled special Cases */
if(unscaled && !usesHFilter && !usesVFilter)