@@ -679,7 +679,7 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref)
if (link->type == AVMEDIA_TYPE_VIDEO) {
if(ref && ref->type == AVMEDIA_TYPE_VIDEO){
- int has_alpha= av_pix_fmt_desc_get(ref->format)->nb_components % 2 == 0 || (av_pix_fmt_desc_get(ref->format)->flags & AV_PIX_FMT_FLAG_PAL);
+ int has_alpha = av_pix_fmt_desc_has_alpha(av_pix_fmt_desc_get(ref->format));
enum AVPixelFormat best= AV_PIX_FMT_NONE;
int i;
for (i=0; i<link->in_formats->nb_formats; i++) {
@@ -2482,10 +2482,6 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
#define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
#define FF_COLOR_XYZ 4
-#define pixdesc_has_alpha(pixdesc) \
- ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)
-
-
static int get_color_type(const AVPixFmtDescriptor *desc) {
if (desc->flags & AV_PIX_FMT_FLAG_PAL)
return FF_COLOR_RGB;
@@ -2625,12 +2621,12 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
loss |= FF_LOSS_CHROMA;
score -= 2 * 65536;
}
- if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
+ if (!av_pix_fmt_desc_has_alpha(dst_desc) && (av_pix_fmt_desc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) {
loss |= FF_LOSS_ALPHA;
score -= 65536;
}
if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) &&
- (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
+ (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (av_pix_fmt_desc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) {
loss |= FF_LOSS_COLORQUANT;
score -= 65536;
}
Signed-off-by: Marton Balint <cus@passwd.hu> --- libavfilter/avfiltergraph.c | 2 +- libavutil/pixdesc.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-)