Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1660)

Unified Diff: patched-ffmpeg-mt/libswscale/utils.c

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: patched-ffmpeg-mt/libswscale/utils.c
===================================================================
--- patched-ffmpeg-mt/libswscale/utils.c (revision 41250)
+++ patched-ffmpeg-mt/libswscale/utils.c (working copy)
@@ -92,6 +92,10 @@
|| (x)==PIX_FMT_YUV444P \
|| (x)==PIX_FMT_YUV422P \
|| (x)==PIX_FMT_YUV411P \
+ || (x)==PIX_FMT_YUVJ420P \
+ || (x)==PIX_FMT_YUVJ422P \
+ || (x)==PIX_FMT_YUVJ440P \
+ || (x)==PIX_FMT_YUVJ444P \
|| (x)==PIX_FMT_PAL8 \
|| (x)==PIX_FMT_BGR8 \
|| (x)==PIX_FMT_RGB8 \
@@ -121,8 +125,11 @@
|| (x)==PIX_FMT_YUV444P \
|| (x)==PIX_FMT_YUV422P \
|| (x)==PIX_FMT_YUV411P \
- || isRGB(x) \
- || isBGR(x) \
+ || (x)==PIX_FMT_YUVJ420P \
+ || (x)==PIX_FMT_YUVJ422P \
+ || (x)==PIX_FMT_YUVJ440P \
+ || (x)==PIX_FMT_YUVJ444P \
+ || isAnyRGB(x) \
|| (x)==PIX_FMT_NV12 \
|| (x)==PIX_FMT_NV21 \
|| (x)==PIX_FMT_GRAY16BE \
@@ -143,8 +150,6 @@
return isSupportedOut(pix_fmt);
}
-#define usePal(x) (av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL)
-
extern const int32_t ff_yuv2rgb_coeffs[8][4];
const char *sws_format_name(enum PixelFormat format)
@@ -780,7 +785,6 @@
int dstW, int dstH, enum PixelFormat dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
{
-
SwsContext *c;
int i;
int usesVFilter, usesHFilter;
@@ -858,28 +862,27 @@
c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]);
c->vRounder= 4* 0x0001000100010001ULL;
- usesHFilter= usesVFilter= 0;
- if (dstFilter->lumV && dstFilter->lumV->length>1) usesVFilter=1;
- if (dstFilter->lumH && dstFilter->lumH->length>1) usesHFilter=1;
- if (dstFilter->chrV && dstFilter->chrV->length>1) usesVFilter=1;
- if (dstFilter->chrH && dstFilter->chrH->length>1) usesHFilter=1;
- if (srcFilter->lumV && srcFilter->lumV->length>1) usesVFilter=1;
- if (srcFilter->lumH && srcFilter->lumH->length>1) usesHFilter=1;
- if (srcFilter->chrV && srcFilter->chrV->length>1) usesVFilter=1;
- if (srcFilter->chrH && srcFilter->chrH->length>1) usesHFilter=1;
+ usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) ||
+ (srcFilter->chrV && srcFilter->chrV->length>1) ||
+ (dstFilter->lumV && dstFilter->lumV->length>1) ||
+ (dstFilter->chrV && dstFilter->chrV->length>1);
+ usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) ||
+ (srcFilter->chrH && srcFilter->chrH->length>1) ||
+ (dstFilter->lumH && dstFilter->lumH->length>1) ||
+ (dstFilter->chrH && dstFilter->chrH->length>1);
getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
// reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation
- if ((isBGR(dstFormat) || isRGB(dstFormat)) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
+ if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
// drop some chroma lines if the user wants it
c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
c->chrSrcVSubSample+= c->vChrDrop;
// drop every other pixel for chroma calculation unless user wants full chroma
- if ((isBGR(srcFormat) || isRGB(srcFormat)) && !(flags&SWS_FULL_CHR_H_INP)
+ if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP)
&& srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8
&& srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4
&& srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE
@@ -903,7 +906,7 @@
sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16);
/* unscaled special cases */
- if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isBGR(dstFormat) || isRGB(dstFormat))) {
+ if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isAnyRGB(dstFormat))) {
ff_get_unscaled_swscale(c);
if (c->swScale) {
@@ -965,6 +968,8 @@
c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize);
#endif
+ if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode)
+ goto fail;
FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail);
@@ -1126,9 +1131,7 @@
av_log(c, AV_LOG_INFO, "using AltiVec\n");
else
av_log(c, AV_LOG_INFO, "using C\n");
- }
- if (flags & SWS_PRINT_INFO) {
if (flags & SWS_CPU_CAPS_MMX) {
if (c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
@@ -1308,7 +1311,7 @@
return sws_getConstVec(1.0, 1);
}
-double sws_dcVec(SwsVector *a)
+static double sws_dcVec(SwsVector *a)
{
int i;
double sum=0;
@@ -1537,8 +1540,8 @@
if (c->lumMmx2FilterCode) munmap(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize);
if (c->chrMmx2FilterCode) munmap(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize);
#elif HAVE_VIRTUALALLOC
- if (c->lumMmx2FilterCode) VirtualFree(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, MEM_RELEASE);
- if (c->chrMmx2FilterCode) VirtualFree(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, MEM_RELEASE);
+ if (c->lumMmx2FilterCode) VirtualFree(c->lumMmx2FilterCode, 0, MEM_RELEASE);
+ if (c->chrMmx2FilterCode) VirtualFree(c->chrMmx2FilterCode, 0, MEM_RELEASE);
#else
av_free(c->lumMmx2FilterCode);
av_free(c->chrMmx2FilterCode);
@@ -1562,17 +1565,20 @@
if (!param)
param = default_param;
- if (context) {
- if (context->srcW != srcW || context->srcH != srcH ||
- context->srcFormat != srcFormat ||
- context->dstW != dstW || context->dstH != dstH ||
- context->dstFormat != dstFormat || context->flags != flags ||
- context->param[0] != param[0] || context->param[1] != param[1])
- {
- sws_freeContext(context);
- context = NULL;
- }
+ if (context &&
+ (context->srcW != srcW ||
+ context->srcH != srcH ||
+ context->srcFormat != srcFormat ||
+ context->dstW != dstW ||
+ context->dstH != dstH ||
+ context->dstFormat != dstFormat ||
+ context->flags != flags ||
+ context->param[0] != param[0] ||
+ context->param[1] != param[1])) {
+ sws_freeContext(context);
+ context = NULL;
}
+
if (!context) {
return sws_getContext(srcW, srcH, srcFormat,
dstW, dstH, dstFormat, flags,

Powered by Google App Engine
This is Rietveld 408576698