Commit 6b1bed14 authored by lucabe's avatar lucabe

Add support for YUVJ formats


git-svn-id: file:///var/local/repositories/mplayer/trunk/libswscale@19993 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 6afcc4e6
...@@ -1841,6 +1841,23 @@ int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int ...@@ -1841,6 +1841,23 @@ int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int
return 0; 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, SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param){ SwsFilter *srcFilter, SwsFilter *dstFilter, double *param){
...@@ -1848,6 +1865,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH ...@@ -1848,6 +1865,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
int i; int i;
int usesVFilter, usesHFilter; int usesVFilter, usesHFilter;
int unscaled, needsDither; int unscaled, needsDither;
int srcRange, dstRange;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
#if defined(ARCH_X86) || defined(ARCH_X86_64) #if defined(ARCH_X86) || defined(ARCH_X86_64)
if(flags & SWS_CPU_CAPS_MMX) if(flags & SWS_CPU_CAPS_MMX)
...@@ -1874,6 +1892,9 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH ...@@ -1874,6 +1892,9 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
&& (fmt_depth(dstFormat))<24 && (fmt_depth(dstFormat))<24
&& ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat)))); && ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat))));
srcRange = handle_jpeg(&srcFormat);
dstRange = handle_jpeg(&dstFormat);
if(!isSupportedIn(srcFormat)) if(!isSupportedIn(srcFormat))
{ {
MSG_ERR("swScaler: %s is not supported as input format\n", sws_format_name(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 ...@@ -1951,7 +1972,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
c->chrDstW= -((-dstW) >> c->chrDstHSubSample); c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
c->chrDstH= -((-dstH) >> c->chrDstVSubSample); 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 */ /* unscaled special Cases */
if(unscaled && !usesHFilter && !usesVFilter) if(unscaled && !usesHFilter && !usesVFilter)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment