X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fimgconvert.c;h=cbd46cdc18823da961dc7bb9a163fff30a090bc8;hb=2a54ae9df8cbc1717b3929222ac75f384e2ff240;hp=c038d893a64007959f71a907e43d3650bfbe845a;hpb=4453f6b8613b0803246c1a9160c8270ec9de1237;p=ffmpeg diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index c038d893a64..cbd46cdc188 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -35,10 +35,11 @@ #include "internal.h" #include "imgconvert.h" #include "libavutil/colorspace.h" +#include "libavutil/common.h" #include "libavutil/pixdesc.h" #include "libavutil/imgutils.h" -#if HAVE_MMX && HAVE_YASM +#if HAVE_MMX_EXTERNAL #include "x86/dsputil_mmx.h" #endif @@ -47,7 +48,7 @@ #define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */ #define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */ -#if HAVE_MMX && HAVE_YASM +#if HAVE_MMX_EXTERNAL #define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx #define deinterlace_line ff_deinterlace_line_mmx #else @@ -90,6 +91,78 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { [PIX_FMT_YUV440P] = { .color_type = FF_COLOR_YUV, }, + [PIX_FMT_YUV420P9LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV422P9LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV444P9LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV420P9BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV422P9BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV444P9BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV420P10LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV422P10LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV444P10LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV420P10BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV422P10BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV444P10BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV420P12LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV422P12LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV444P12LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV420P12BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV422P12BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV444P12BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV420P14LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV422P14LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV444P14LE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV420P14BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV422P14BE] = { + .color_type = FF_COLOR_YUV, + }, + [PIX_FMT_YUV444P14BE] = { + .color_type = FF_COLOR_YUV, + }, [PIX_FMT_YUV420P16LE] = { .color_type = FF_COLOR_YUV, }, @@ -280,6 +353,40 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { [PIX_FMT_RGBA] = { .color_type = FF_COLOR_RGB, }, + + [PIX_FMT_GBRP] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP9BE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP9LE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP10BE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP10LE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP12BE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP12LE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP14BE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP14LE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP16BE] = { + .color_type = FF_COLOR_RGB, + }, + [PIX_FMT_GBRP16LE] = { + .color_type = FF_COLOR_RGB, + }, }; void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift) @@ -409,6 +516,7 @@ static int avg_bits_per_pixel(enum PixelFormat pix_fmt) info->padded_size : av_get_bits_per_pixel(desc); } +#if FF_API_FIND_BEST_PIX_FMT enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) { @@ -421,12 +529,13 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma dst_pix_fmt = PIX_FMT_NONE; /* so first iteration doesn't have to be treated special */ for(i = 0; i< FFMIN(PIX_FMT_NB, 64); i++){ if (pix_fmt_mask & (1ULL << i)) - dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt, i, src_pix_fmt, has_alpha, loss_ptr); + dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt, i, src_pix_fmt, has_alpha, loss_ptr); } return dst_pix_fmt; } +#endif /* FF_API_FIND_BEST_PIX_FMT */ -enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, +enum PixelFormat avcodec_find_best_pix_fmt_of_2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) { enum PixelFormat dst_pix_fmt; @@ -435,6 +544,7 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum ~0, /* no loss first */ ~FF_LOSS_ALPHA, ~FF_LOSS_RESOLUTION, + ~FF_LOSS_COLORSPACE, ~(FF_LOSS_COLORSPACE | FF_LOSS_RESOLUTION), ~FF_LOSS_COLORQUANT, ~FF_LOSS_DEPTH, @@ -467,6 +577,25 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum return dst_pix_fmt; } +enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, + enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) +{ + return avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, has_alpha, loss_ptr); +} + +enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_list, + enum PixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr){ + int i; + + enum PixelFormat best = PIX_FMT_NONE; + + for(i=0; pix_fmt_list[i] != PIX_FMT_NONE; i++) + best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr); + + return best; +} + void av_picture_copy(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int width, int height) { @@ -692,7 +821,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, return 0; } -#if !(HAVE_MMX && HAVE_YASM) +#if !HAVE_MMX_EXTERNAL /* filter parameters: [-1 4 2 4 -1] // 8 */ static void deinterlace_line_c(uint8_t *dst, const uint8_t *lum_m4, const uint8_t *lum_m3, @@ -741,7 +870,7 @@ static void deinterlace_line_inplace_c(uint8_t *lum_m4, uint8_t *lum_m3, lum++; } } -#endif +#endif /* !HAVE_MMX_EXTERNAL */ /* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The top field is copied as is, but the bottom field is deinterlaced