int is_supported_in, is_supported_out;
} FormatEntry;
-const static FormatEntry format_entries[PIX_FMT_NB] = {
+static const FormatEntry format_entries[PIX_FMT_NB] = {
[PIX_FMT_YUV420P] = { 1 , 1 },
[PIX_FMT_YUYV422] = { 1 , 1 },
[PIX_FMT_RGB24] = { 1 , 1 },
[PIX_FMT_YUV440P] = { 1 , 1 },
[PIX_FMT_YUVJ440P] = { 1 , 1 },
[PIX_FMT_YUVA420P] = { 1 , 1 },
+ [PIX_FMT_YUVA444P] = { 1 , 1 },
[PIX_FMT_RGB48BE] = { 1 , 1 },
[PIX_FMT_RGB48LE] = { 1 , 1 },
[PIX_FMT_RGBA64BE] = { 0 , 0 },
[PIX_FMT_YUV422P16BE] = { 1 , 1 },
[PIX_FMT_YUV444P16LE] = { 1 , 1 },
[PIX_FMT_YUV444P16BE] = { 1 , 1 },
- [PIX_FMT_RGB444LE] = { 0 , 1 },
- [PIX_FMT_RGB444BE] = { 0 , 1 },
- [PIX_FMT_BGR444LE] = { 0 , 1 },
- [PIX_FMT_BGR444BE] = { 0 , 1 },
+ [PIX_FMT_RGB444LE] = { 1 , 1 },
+ [PIX_FMT_RGB444BE] = { 1 , 1 },
+ [PIX_FMT_BGR444LE] = { 1 , 1 },
+ [PIX_FMT_BGR444BE] = { 1 , 1 },
[PIX_FMT_Y400A] = { 1 , 0 },
[PIX_FMT_BGR48BE] = { 1 , 1 },
[PIX_FMT_BGR48LE] = { 1 , 1 },
if (xInc <= 1<<16) filterSize= 1 + sizeFactor; // upscale
else filterSize= 1 + (sizeFactor*srcW + dstW - 1)/ dstW;
- if (filterSize > srcW-2) filterSize=srcW-2;
+ filterSize = av_clip(filterSize, 1, srcW - 2);
FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
case PIX_FMT_YUVJ422P: *format = PIX_FMT_YUV422P; return 1;
case PIX_FMT_YUVJ444P: *format = PIX_FMT_YUV444P; return 1;
case PIX_FMT_YUVJ440P: *format = PIX_FMT_YUV440P; return 1;
- case PIX_FMT_0BGR : *format = PIX_FMT_ABGR ; return 0;
- case PIX_FMT_BGR0 : *format = PIX_FMT_BGRA ; return 0;
- case PIX_FMT_0RGB : *format = PIX_FMT_ARGB ; return 0;
- case PIX_FMT_RGB0 : *format = PIX_FMT_RGBA ; return 0;
+ default: return 0;
+ }
+}
+
+static int handle_0alpha(enum PixelFormat *format)
+{
+ switch (*format) {
+ case PIX_FMT_0BGR : *format = PIX_FMT_ABGR ; return 1;
+ case PIX_FMT_BGR0 : *format = PIX_FMT_BGRA ; return 4;
+ case PIX_FMT_0RGB : *format = PIX_FMT_ARGB ; return 1;
+ case PIX_FMT_RGB0 : *format = PIX_FMT_RGBA ; return 4;
default: return 0;
}
}
handle_jpeg(&srcFormat);
handle_jpeg(&dstFormat);
+ handle_0alpha(&srcFormat);
+ handle_0alpha(&dstFormat);
if(srcFormat!=c->srcFormat || dstFormat!=c->dstFormat){
av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n");
|SWS_SPLINE
|SWS_BICUBLIN);
if(!i || (i & (i-1))) {
- av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n");
+ av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen, got %X\n", i);
return AVERROR(EINVAL);
}
/* sanity check */
getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
// reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation
- if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
+ if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) {
+ if (dstW&1) {
+ av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n");
+ flags |= SWS_FULL_CHR_H_INT;
+ c->flags = flags;
+ } else
+ 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->dstH= dstH;
c->srcRange = handle_jpeg(&srcFormat);
c->dstRange = handle_jpeg(&dstFormat);
+ c->src0Alpha = handle_0alpha(&srcFormat);
+ c->dst0Alpha = handle_0alpha(&dstFormat);
c->srcFormat= srcFormat;
c->dstFormat= dstFormat;
context->srcW = srcW;
context->srcH = srcH;
context->srcRange = handle_jpeg(&srcFormat);
+ context->src0Alpha = handle_0alpha(&srcFormat);
context->srcFormat = srcFormat;
context->dstW = dstW;
context->dstH = dstH;
context->dstRange = handle_jpeg(&dstFormat);
+ context->dst0Alpha = handle_0alpha(&dstFormat);
context->dstFormat = dstFormat;
context->flags = flags;
context->param[0] = param[0];
}
return context;
}
-