From a2318326f13f0e86c6d7222ec15659d2fa7d666f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 28 Aug 2012 11:21:59 +0200 Subject: [PATCH 01/12] lavc: add lossy/lossless codec properties. --- doc/APIchanges | 4 + libavcodec/avcodec.h | 10 ++ libavcodec/codec_desc.c | 363 +++++++++++++++++++++++++++++++++------- libavcodec/version.h | 2 +- 4 files changed, 313 insertions(+), 66 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index f919e53fbc..dda0996b93 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,10 @@ libavutil: 2011-04-18 API changes, most recent first: +2012-xx-xx - xxxxxxx - lavc 54.26.1 - avcodec.h + Add codec descriptor properties AV_CODEC_PROP_LOSSY and + AV_CODEC_PROP_LOSSLESS. + 2012-08-18 - lavc 54.26 - avcodec.h Add codec descriptors for accessing codec properties without having to refer to a specific decoder or encoder. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 07d75c2692..742a2a39cb 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -467,6 +467,16 @@ typedef struct AVCodecDescriptor { * Video codecs only. */ #define AV_CODEC_PROP_INTRA_ONLY (1 << 0) +/** + * Codec supports lossy compression. Audio and video codecs only. + * @note a codec may support both lossy and lossless + * compression modes + */ +#define AV_CODEC_PROP_LOSSY (1 << 1) +/** + * Codec supports lossless compression. Audio and video codecs only. + */ +#define AV_CODEC_PROP_LOSSLESS (1 << 2) #if FF_API_OLD_DECODE_AUDIO /* in bytes */ diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 30a4e4a778..513a15c090 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -30,1067 +30,1175 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_VIDEO, .name = "mpeg1video", .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MPEG2VIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "mpeg2video", .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MPEG2VIDEO_XVMC, .type = AVMEDIA_TYPE_VIDEO, .name = "mpegvideo_xvmc", .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_H261, .type = AVMEDIA_TYPE_VIDEO, .name = "h261", .long_name = NULL_IF_CONFIG_SMALL("H.261"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_H263, .type = AVMEDIA_TYPE_VIDEO, .name = "h263", .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_RV10, .type = AVMEDIA_TYPE_VIDEO, .name = "rv10", .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_RV20, .type = AVMEDIA_TYPE_VIDEO, .name = "rv20", .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MJPEG, .type = AVMEDIA_TYPE_VIDEO, .name = "mjpeg", .long_name = NULL_IF_CONFIG_SMALL("Motion JPEG"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MJPEGB, .type = AVMEDIA_TYPE_VIDEO, .name = "mjpegb", .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_LJPEG, .type = AVMEDIA_TYPE_VIDEO, .name = "ljpeg", .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_SP5X, .type = AVMEDIA_TYPE_VIDEO, .name = "sp5x", .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_JPEGLS, .type = AVMEDIA_TYPE_VIDEO, .name = "jpegls", .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | + AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_MPEG4, .type = AVMEDIA_TYPE_VIDEO, .name = "mpeg4", .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_RAWVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "rawvideo", .long_name = NULL_IF_CONFIG_SMALL("raw video"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_MSMPEG4V1, .type = AVMEDIA_TYPE_VIDEO, .name = "msmpeg4v1", .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MSMPEG4V2, .type = AVMEDIA_TYPE_VIDEO, .name = "msmpeg4v2", .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MSMPEG4V3, .type = AVMEDIA_TYPE_VIDEO, .name = "msmpeg4v3", .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMV1, .type = AVMEDIA_TYPE_VIDEO, .name = "wmv1", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMV2, .type = AVMEDIA_TYPE_VIDEO, .name = "wmv2", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_H263P, .type = AVMEDIA_TYPE_VIDEO, .name = "h263p", .long_name = NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_H263I, .type = AVMEDIA_TYPE_VIDEO, .name = "h263i", .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_FLV1, .type = AVMEDIA_TYPE_VIDEO, .name = "flv1", .long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_SVQ1, .type = AVMEDIA_TYPE_VIDEO, .name = "svq1", .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_SVQ3, .type = AVMEDIA_TYPE_VIDEO, .name = "svq3", .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3 / Sorenson Video 3 / SVQ3"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_DVVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "dvvideo", .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_HUFFYUV, .type = AVMEDIA_TYPE_VIDEO, .name = "huffyuv", .long_name = NULL_IF_CONFIG_SMALL("HuffYUV"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_CYUV, .type = AVMEDIA_TYPE_VIDEO, .name = "cyuv", .long_name = NULL_IF_CONFIG_SMALL("Creative YUV (CYUV)"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_H264, .type = AVMEDIA_TYPE_VIDEO, .name = "h264", .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_INDEO3, .type = AVMEDIA_TYPE_VIDEO, .name = "indeo3", .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VP3, .type = AVMEDIA_TYPE_VIDEO, .name = "vp3", .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_THEORA, .type = AVMEDIA_TYPE_VIDEO, .name = "theora", .long_name = NULL_IF_CONFIG_SMALL("Theora"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ASV1, .type = AVMEDIA_TYPE_VIDEO, .name = "asv1", .long_name = NULL_IF_CONFIG_SMALL("ASUS V1"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ASV2, .type = AVMEDIA_TYPE_VIDEO, .name = "asv2", .long_name = NULL_IF_CONFIG_SMALL("ASUS V2"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_FFV1, .type = AVMEDIA_TYPE_VIDEO, .name = "ffv1", .long_name = NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_4XM, .type = AVMEDIA_TYPE_VIDEO, .name = "4xm", .long_name = NULL_IF_CONFIG_SMALL("4X Movie"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VCR1, .type = AVMEDIA_TYPE_VIDEO, .name = "vcr1", .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_CLJR, .type = AVMEDIA_TYPE_VIDEO, .name = "cljr", .long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MDEC, .type = AVMEDIA_TYPE_VIDEO, .name = "mdec", .long_name = NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ROQ, .type = AVMEDIA_TYPE_VIDEO, .name = "roq", .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_INTERPLAY_VIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "interplayvideo", .long_name = NULL_IF_CONFIG_SMALL("Interplay MVE video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_XAN_WC3, .type = AVMEDIA_TYPE_VIDEO, .name = "xan_wc3", .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_XAN_WC4, .type = AVMEDIA_TYPE_VIDEO, .name = "xan_wc4", .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_RPZA, .type = AVMEDIA_TYPE_VIDEO, .name = "rpza", .long_name = NULL_IF_CONFIG_SMALL("QuickTime video (RPZA)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_CINEPAK, .type = AVMEDIA_TYPE_VIDEO, .name = "cinepak", .long_name = NULL_IF_CONFIG_SMALL("Cinepak"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WS_VQA, .type = AVMEDIA_TYPE_VIDEO, .name = "ws_vqa", .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA (Vector Quantized Animation) video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MSRLE, .type = AVMEDIA_TYPE_VIDEO, .name = "msrle", .long_name = NULL_IF_CONFIG_SMALL("Microsoft RLE"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_MSVIDEO1, .type = AVMEDIA_TYPE_VIDEO, .name = "msvideo1", .long_name = NULL_IF_CONFIG_SMALL("Microsoft Video 1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_IDCIN, .type = AVMEDIA_TYPE_VIDEO, .name = "idcin", .long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_8BPS, .type = AVMEDIA_TYPE_VIDEO, .name = "8bps", .long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_SMC, .type = AVMEDIA_TYPE_VIDEO, .name = "smc", .long_name = NULL_IF_CONFIG_SMALL("QuickTime Graphics (SMC)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_FLIC, .type = AVMEDIA_TYPE_VIDEO, .name = "flic", .long_name = NULL_IF_CONFIG_SMALL("Autodesk Animator Flic video"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_TRUEMOTION1, .type = AVMEDIA_TYPE_VIDEO, .name = "truemotion1", .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 1.0"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VMDVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "vmdvideo", .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MSZH, .type = AVMEDIA_TYPE_VIDEO, .name = "mszh", .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) MSZH"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_ZLIB, .type = AVMEDIA_TYPE_VIDEO, .name = "zlib", .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_QTRLE, .type = AVMEDIA_TYPE_VIDEO, .name = "qtrle", .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_SNOW, .type = AVMEDIA_TYPE_VIDEO, .name = "snow", .long_name = NULL_IF_CONFIG_SMALL("Snow"), + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_TSCC, .type = AVMEDIA_TYPE_VIDEO, .name = "tscc", .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Capture Codec"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_ULTI, .type = AVMEDIA_TYPE_VIDEO, .name = "ulti", .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_QDRAW, .type = AVMEDIA_TYPE_VIDEO, .name = "qdraw", .long_name = NULL_IF_CONFIG_SMALL("Apple QuickDraw"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_VIXL, .type = AVMEDIA_TYPE_VIDEO, .name = "vixl", .long_name = NULL_IF_CONFIG_SMALL("Miro VideoXL"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_QPEG, .type = AVMEDIA_TYPE_VIDEO, .name = "qpeg", .long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_PNG, .type = AVMEDIA_TYPE_VIDEO, .name = "png", .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PPM, .type = AVMEDIA_TYPE_VIDEO, .name = "ppm", .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PBM, .type = AVMEDIA_TYPE_VIDEO, .name = "pbm", .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PGM, .type = AVMEDIA_TYPE_VIDEO, .name = "pgm", .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PGMYUV, .type = AVMEDIA_TYPE_VIDEO, .name = "pgmyuv", .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PAM, .type = AVMEDIA_TYPE_VIDEO, .name = "pam", .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_FFVHUFF, .type = AVMEDIA_TYPE_VIDEO, .name = "ffvhuff", .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_RV30, .type = AVMEDIA_TYPE_VIDEO, .name = "rv30", .long_name = NULL_IF_CONFIG_SMALL("RealVideo 3.0"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_RV40, .type = AVMEDIA_TYPE_VIDEO, .name = "rv40", .long_name = NULL_IF_CONFIG_SMALL("RealVideo 4.0"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VC1, .type = AVMEDIA_TYPE_VIDEO, .name = "vc1", .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMV3, .type = AVMEDIA_TYPE_VIDEO, .name = "wmv3", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_LOCO, .type = AVMEDIA_TYPE_VIDEO, .name = "loco", .long_name = NULL_IF_CONFIG_SMALL("LOCO"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_WNV1, .type = AVMEDIA_TYPE_VIDEO, .name = "wnv1", .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_AASC, .type = AVMEDIA_TYPE_VIDEO, .name = "aasc", .long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_INDEO2, .type = AVMEDIA_TYPE_VIDEO, .name = "indeo2", .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_FRAPS, .type = AVMEDIA_TYPE_VIDEO, .name = "fraps", .long_name = NULL_IF_CONFIG_SMALL("Fraps"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_TRUEMOTION2, .type = AVMEDIA_TYPE_VIDEO, .name = "truemotion2", .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_BMP, .type = AVMEDIA_TYPE_VIDEO, .name = "bmp", .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_CSCD, .type = AVMEDIA_TYPE_VIDEO, .name = "cscd", .long_name = NULL_IF_CONFIG_SMALL("CamStudio"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_MMVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "mmvideo", .long_name = NULL_IF_CONFIG_SMALL("American Laser Games MM Video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ZMBV, .type = AVMEDIA_TYPE_VIDEO, .name = "zmbv", .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_AVS, .type = AVMEDIA_TYPE_VIDEO, .name = "avs", .long_name = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_SMACKVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "smackvideo", .long_name = NULL_IF_CONFIG_SMALL("Smacker video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_NUV, .type = AVMEDIA_TYPE_VIDEO, .name = "nuv", .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo/RTJPEG"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_KMVC, .type = AVMEDIA_TYPE_VIDEO, .name = "kmvc", .long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_FLASHSV, .type = AVMEDIA_TYPE_VIDEO, .name = "flashsv", .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v1"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_CAVS, .type = AVMEDIA_TYPE_VIDEO, .name = "cavs", .long_name = NULL_IF_CONFIG_SMALL("Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_JPEG2000, .type = AVMEDIA_TYPE_VIDEO, .name = "jpeg2000", .long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | + AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_VMNC, .type = AVMEDIA_TYPE_VIDEO, .name = "vmnc", .long_name = NULL_IF_CONFIG_SMALL("VMware Screen Codec / VMware Video"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_VP5, .type = AVMEDIA_TYPE_VIDEO, .name = "vp5", .long_name = NULL_IF_CONFIG_SMALL("On2 VP5"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VP6, .type = AVMEDIA_TYPE_VIDEO, .name = "vp6", .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VP6F, .type = AVMEDIA_TYPE_VIDEO, .name = "vp6f", .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TARGA, .type = AVMEDIA_TYPE_VIDEO, .name = "targa", .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_DSICINVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "dsicinvideo", .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TIERTEXSEQVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "tiertexseqvideo", .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TIFF, .type = AVMEDIA_TYPE_VIDEO, .name = "tiff", .long_name = NULL_IF_CONFIG_SMALL("TIFF image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_GIF, .type = AVMEDIA_TYPE_VIDEO, .name = "gif", .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_DXA, .type = AVMEDIA_TYPE_VIDEO, .name = "dxa", .long_name = NULL_IF_CONFIG_SMALL("Feeble Files/ScummVM DXA"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_DNXHD, .type = AVMEDIA_TYPE_VIDEO, .name = "dnxhd", .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_THP, .type = AVMEDIA_TYPE_VIDEO, .name = "thp", .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_SGI, .type = AVMEDIA_TYPE_VIDEO, .name = "sgi", .long_name = NULL_IF_CONFIG_SMALL("SGI image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_C93, .type = AVMEDIA_TYPE_VIDEO, .name = "c93", .long_name = NULL_IF_CONFIG_SMALL("Interplay C93"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_BETHSOFTVID, .type = AVMEDIA_TYPE_VIDEO, .name = "bethsoftvid", .long_name = NULL_IF_CONFIG_SMALL("Bethesda VID video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_PTX, .type = AVMEDIA_TYPE_VIDEO, .name = "ptx", .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TXD, .type = AVMEDIA_TYPE_VIDEO, .name = "txd", .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VP6A, .type = AVMEDIA_TYPE_VIDEO, .name = "vp6a", .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_AMV, .type = AVMEDIA_TYPE_VIDEO, .name = "amv", .long_name = NULL_IF_CONFIG_SMALL("AMV Video"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VB, .type = AVMEDIA_TYPE_VIDEO, .name = "vb", .long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_PCX, .type = AVMEDIA_TYPE_VIDEO, .name = "pcx", .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_SUNRAST, .type = AVMEDIA_TYPE_VIDEO, .name = "sunrast", .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_INDEO4, .type = AVMEDIA_TYPE_VIDEO, .name = "indeo4", .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_INDEO5, .type = AVMEDIA_TYPE_VIDEO, .name = "indeo5", .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 5"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MIMIC, .type = AVMEDIA_TYPE_VIDEO, .name = "mimic", .long_name = NULL_IF_CONFIG_SMALL("Mimic"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_RL2, .type = AVMEDIA_TYPE_VIDEO, .name = "rl2", .long_name = NULL_IF_CONFIG_SMALL("RL2 video"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ESCAPE124, .type = AVMEDIA_TYPE_VIDEO, .name = "escape124", .long_name = NULL_IF_CONFIG_SMALL("Escape 124"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_DIRAC, .type = AVMEDIA_TYPE_VIDEO, .name = "dirac", .long_name = NULL_IF_CONFIG_SMALL("Dirac"), + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_BFI, .type = AVMEDIA_TYPE_VIDEO, .name = "bfi", .long_name = NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_CMV, .type = AVMEDIA_TYPE_VIDEO, .name = "cmv", .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts CMV video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MOTIONPIXELS, .type = AVMEDIA_TYPE_VIDEO, .name = "motionpixels", .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TGV, .type = AVMEDIA_TYPE_VIDEO, .name = "tgv", .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGV video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TGQ, .type = AVMEDIA_TYPE_VIDEO, .name = "tgq", .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TQI, .type = AVMEDIA_TYPE_VIDEO, .name = "tqi", .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TQI video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_AURA, .type = AVMEDIA_TYPE_VIDEO, .name = "aura", .long_name = NULL_IF_CONFIG_SMALL("Auravision AURA"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_AURA2, .type = AVMEDIA_TYPE_VIDEO, .name = "aura2", .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_V210X, .type = AVMEDIA_TYPE_VIDEO, .name = "v210x", - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_TMV, .type = AVMEDIA_TYPE_VIDEO, .name = "tmv", - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_V210, .type = AVMEDIA_TYPE_VIDEO, .name = "v210", .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_DPX, .type = AVMEDIA_TYPE_VIDEO, .name = "dpx", .long_name = NULL_IF_CONFIG_SMALL("DPX image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MAD, .type = AVMEDIA_TYPE_VIDEO, .name = "mad", - .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Madcow Video") + .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Madcow Video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_FRWU, .type = AVMEDIA_TYPE_VIDEO, .name = "frwu", .long_name = NULL_IF_CONFIG_SMALL("Forward Uncompressed"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_FLASHSV2, .type = AVMEDIA_TYPE_VIDEO, .name = "flashsv2", .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_CDGRAPHICS, .type = AVMEDIA_TYPE_VIDEO, .name = "cdgraphics", .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_R210, .type = AVMEDIA_TYPE_VIDEO, .name = "r210", .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_ANM, .type = AVMEDIA_TYPE_VIDEO, .name = "anm", .long_name = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_BINKVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "binkvideo", .long_name = NULL_IF_CONFIG_SMALL("Bink video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_IFF_ILBM, .type = AVMEDIA_TYPE_VIDEO, .name = "iff_ilbm", .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_IFF_BYTERUN1, .type = AVMEDIA_TYPE_VIDEO, .name = "iff_byterun1", .long_name = NULL_IF_CONFIG_SMALL("IFF ByteRun1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_KGV1, .type = AVMEDIA_TYPE_VIDEO, .name = "kgv1", .long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_YOP, .type = AVMEDIA_TYPE_VIDEO, .name = "yop", .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VP8, .type = AVMEDIA_TYPE_VIDEO, .name = "vp8", .long_name = NULL_IF_CONFIG_SMALL("On2 VP8"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_PICTOR, .type = AVMEDIA_TYPE_VIDEO, .name = "pictor", .long_name = NULL_IF_CONFIG_SMALL("Pictor/PC Paint"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ANSI, .type = AVMEDIA_TYPE_VIDEO, .name = "ansi", .long_name = NULL_IF_CONFIG_SMALL("ASCII/ANSI art"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_A64_MULTI, .type = AVMEDIA_TYPE_VIDEO, .name = "a64_multi", .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_A64_MULTI5, .type = AVMEDIA_TYPE_VIDEO, .name = "a64_multi5", .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_R10K, .type = AVMEDIA_TYPE_VIDEO, .name = "r10k", .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_MXPEG, .type = AVMEDIA_TYPE_VIDEO, .name = "mxpeg", .long_name = NULL_IF_CONFIG_SMALL("Mobotix MxPEG video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_LAGARITH, .type = AVMEDIA_TYPE_VIDEO, .name = "lagarith", .long_name = NULL_IF_CONFIG_SMALL("Lagarith lossless"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PRORES, .type = AVMEDIA_TYPE_VIDEO, .name = "prores", .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_JV, .type = AVMEDIA_TYPE_VIDEO, .name = "jv", .long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_DFA, .type = AVMEDIA_TYPE_VIDEO, .name = "dfa", .long_name = NULL_IF_CONFIG_SMALL("Chronomaster DFA"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMV3IMAGE, .type = AVMEDIA_TYPE_VIDEO, .name = "wmv3image", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VC1IMAGE, .type = AVMEDIA_TYPE_VIDEO, .name = "vc1image", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image v2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_UTVIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "utvideo", .long_name = NULL_IF_CONFIG_SMALL("Ut Video"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_BMV_VIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "bmv_video", .long_name = NULL_IF_CONFIG_SMALL("Discworld II BMV video"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_VBLE, .type = AVMEDIA_TYPE_VIDEO, .name = "vble", .long_name = NULL_IF_CONFIG_SMALL("VBLE Lossless Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_DXTORY, .type = AVMEDIA_TYPE_VIDEO, .name = "dxtory", .long_name = NULL_IF_CONFIG_SMALL("Dxtory"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_V410, .type = AVMEDIA_TYPE_VIDEO, .name = "v410", .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:4:4 10-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_XWD, .type = AVMEDIA_TYPE_VIDEO, .name = "xwd", .long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_CDXL, .type = AVMEDIA_TYPE_VIDEO, .name = "cdxl", .long_name = NULL_IF_CONFIG_SMALL("Commodore CDXL video"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_XBM, .type = AVMEDIA_TYPE_VIDEO, .name = "xbm", - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_ZEROCODEC, .type = AVMEDIA_TYPE_VIDEO, .name = "zerocodec", .long_name = NULL_IF_CONFIG_SMALL("ZeroCodec Lossless Video"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_MSS1, .type = AVMEDIA_TYPE_VIDEO, .name = "mss1", .long_name = NULL_IF_CONFIG_SMALL("MS Screen 1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MSA1, .type = AVMEDIA_TYPE_VIDEO, .name = "msa1", .long_name = NULL_IF_CONFIG_SMALL("MS ATC Screen"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TSCC2, .type = AVMEDIA_TYPE_VIDEO, .name = "tscc2", .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Codec 2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MTS2, .type = AVMEDIA_TYPE_VIDEO, .name = "mts2", .long_name = NULL_IF_CONFIG_SMALL("MS Expression Encoder Screen"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_CLLC, .type = AVMEDIA_TYPE_VIDEO, .name = "cllc", .long_name = NULL_IF_CONFIG_SMALL("Canopus Lossless Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY, + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, /* various PCM "codecs" */ @@ -1099,36 +1207,42 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s16le", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_S16BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s16be", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_U16LE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_u16le", .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 16-bit little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_U16BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_u16be", .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 16-bit big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_S8, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s8", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_U8, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_u8", .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 8-bit"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_MULAW, @@ -1147,120 +1261,140 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s32le", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_S32BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s32be", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_U32LE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_u32le", .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 32-bit little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_U32BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_u32be", .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 32-bit big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_S24LE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s24le", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_S24BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s24be", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_U24LE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_u24le", .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 24-bit little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_U24BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_u24be", .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 24-bit big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_S24DAUD, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s24daud", .long_name = NULL_IF_CONFIG_SMALL("PCM D-Cinema audio signed 24-bit"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_ZORK, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_zork", .long_name = NULL_IF_CONFIG_SMALL("PCM Zork"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_PCM_S16LE_PLANAR, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s16le_planar", .long_name = NULL_IF_CONFIG_SMALL("PCM 16-bit little-endian planar"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_DVD, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_dvd", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 20|24-bit big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_F32BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_f32be", .long_name = NULL_IF_CONFIG_SMALL("PCM 32-bit floating point big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_F32LE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_f32le", .long_name = NULL_IF_CONFIG_SMALL("PCM 32-bit floating point little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_F64BE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_f64be", .long_name = NULL_IF_CONFIG_SMALL("PCM 64-bit floating point big-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_F64LE, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_f64le", .long_name = NULL_IF_CONFIG_SMALL("PCM 64-bit floating point little-endian"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_BLURAY, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_bluray", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_PCM_LXF, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_lxf", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 20-bit little-endian planar"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_S302M, .type = AVMEDIA_TYPE_AUDIO, .name = "s302m", .long_name = NULL_IF_CONFIG_SMALL("SMPTE 302M"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_PCM_S8_PLANAR, .type = AVMEDIA_TYPE_AUDIO, .name = "pcm_s8_planar", .long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit planar"), + .props = AV_CODEC_PROP_LOSSLESS, }, /* various ADPCM codecs */ @@ -1269,180 +1403,210 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_qt", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA QuickTime"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_WAV, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_wav", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA WAV"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_DK3, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_dk3", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Duck DK3"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_DK4, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_dk4", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Duck DK4"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_WS, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_ws", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Westwood"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_SMJPEG, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_smjpeg", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Loki SDL MJPEG"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_MS, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ms", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Microsoft"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_4XM, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_4xm", .long_name = NULL_IF_CONFIG_SMALL("ADPCM 4X Movie"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_XA, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_xa", .long_name = NULL_IF_CONFIG_SMALL("ADPCM CDROM XA"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_ADX, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_adx", .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_EA, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ea", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_G726, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_g726", .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_CT, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ct", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Creative Technology"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_SWF, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_swf", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Shockwave Flash"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_YAMAHA, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_yamaha", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Yamaha"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_SBPRO_4, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_sbpro_4", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 4-bit"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_SBPRO_3, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_sbpro_3", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 2.6-bit"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_SBPRO_2, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_sbpro_2", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 2-bit"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_THP, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_thp", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Nintendo Gamecube THP"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_AMV, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_amv", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA AMV"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_EA_R1, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ea_r1", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_EA_R3, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ea_r3", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R3"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_EA_R2, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ea_r2", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_EA_SEAD, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_ea_sead", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Electronic Arts SEAD"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_EA_EACS, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_ea_eacs", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Electronic Arts EACS"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_EA_XAS, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ea_xas", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts XAS"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_EA_MAXIS_XA, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ea_maxis_xa", .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts Maxis CDROM XA"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_ISS, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_iss", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Funcom ISS"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_G722, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_g722", .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ADPCM_IMA_APC, .type = AVMEDIA_TYPE_AUDIO, .name = "adpcm_ima_apc", .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA CRYO APC"), + .props = AV_CODEC_PROP_LOSSY, }, /* AMR */ @@ -1451,12 +1615,14 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "amr_nb", .long_name = NULL_IF_CONFIG_SMALL("AMR-NB (Adaptive Multi-Rate NarrowBand)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_AMR_WB, .type = AVMEDIA_TYPE_AUDIO, .name = "amr_wb", .long_name = NULL_IF_CONFIG_SMALL("AMR-WB (Adaptive Multi-Rate WideBand)"), + .props = AV_CODEC_PROP_LOSSY, }, /* RealAudio codecs*/ @@ -1465,12 +1631,14 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "ra_144", .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_RA_288, .type = AVMEDIA_TYPE_AUDIO, .name = "ra_288", .long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"), + .props = AV_CODEC_PROP_LOSSY, }, /* various DPCM codecs */ @@ -1479,24 +1647,28 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "roq_dpcm", .long_name = NULL_IF_CONFIG_SMALL("DPCM id RoQ"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_INTERPLAY_DPCM, .type = AVMEDIA_TYPE_AUDIO, .name = "interplay_dpcm", .long_name = NULL_IF_CONFIG_SMALL("DPCM Interplay"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_XAN_DPCM, .type = AVMEDIA_TYPE_AUDIO, .name = "xan_dpcm", .long_name = NULL_IF_CONFIG_SMALL("DPCM Xan"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_SOL_DPCM, .type = AVMEDIA_TYPE_AUDIO, .name = "sol_dpcm", .long_name = NULL_IF_CONFIG_SMALL("DPCM Sol"), + .props = AV_CODEC_PROP_LOSSY, }, /* audio codecs */ @@ -1505,365 +1677,426 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_AUDIO, .name = "mp2", .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MP3, .type = AVMEDIA_TYPE_AUDIO, .name = "mp3", .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_AAC, .type = AVMEDIA_TYPE_AUDIO, .name = "aac", .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_AC3, .type = AVMEDIA_TYPE_AUDIO, .name = "ac3", .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_DTS, .type = AVMEDIA_TYPE_AUDIO, .name = "dts", .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_VORBIS, .type = AVMEDIA_TYPE_AUDIO, .name = "vorbis", .long_name = NULL_IF_CONFIG_SMALL("Vorbis"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_DVAUDIO, .type = AVMEDIA_TYPE_AUDIO, .name = "dvaudio", + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMAV1, .type = AVMEDIA_TYPE_AUDIO, .name = "wmav1", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMAV2, .type = AVMEDIA_TYPE_AUDIO, .name = "wmav2", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MACE3, .type = AVMEDIA_TYPE_AUDIO, .name = "mace3", .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MACE6, .type = AVMEDIA_TYPE_AUDIO, .name = "mace6", .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 6:1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VMDAUDIO, .type = AVMEDIA_TYPE_AUDIO, .name = "vmdaudio", .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD audio"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_FLAC, .type = AVMEDIA_TYPE_AUDIO, .name = "flac", .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_MP3ADU, .type = AVMEDIA_TYPE_AUDIO, .name = "mp3adu", .long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MP3ON4, .type = AVMEDIA_TYPE_AUDIO, .name = "mp3on4", .long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_SHORTEN, .type = AVMEDIA_TYPE_AUDIO, .name = "shorten", .long_name = NULL_IF_CONFIG_SMALL("Shorten"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_ALAC, .type = AVMEDIA_TYPE_AUDIO, .name = "alac", .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_WESTWOOD_SND1, .type = AVMEDIA_TYPE_AUDIO, .name = "westwood_snd1", .long_name = NULL_IF_CONFIG_SMALL("Westwood Audio (SND1)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_GSM, .type = AVMEDIA_TYPE_AUDIO, .name = "gsm", .long_name = NULL_IF_CONFIG_SMALL("GSM"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_QDM2, .type = AVMEDIA_TYPE_AUDIO, .name = "qdm2", .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 2"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_COOK, .type = AVMEDIA_TYPE_AUDIO, .name = "cook", .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TRUESPEECH, .type = AVMEDIA_TYPE_AUDIO, .name = "truespeech", .long_name = NULL_IF_CONFIG_SMALL("DSP Group TrueSpeech"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TTA, .type = AVMEDIA_TYPE_AUDIO, .name = "tta", .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_SMACKAUDIO, .type = AVMEDIA_TYPE_AUDIO, .name = "smackaudio", .long_name = NULL_IF_CONFIG_SMALL("Smacker audio"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_QCELP, .type = AVMEDIA_TYPE_AUDIO, .name = "qcelp", .long_name = NULL_IF_CONFIG_SMALL("QCELP / PureVoice"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WAVPACK, .type = AVMEDIA_TYPE_AUDIO, .name = "wavpack", .long_name = NULL_IF_CONFIG_SMALL("WavPack"), + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_DSICINAUDIO, .type = AVMEDIA_TYPE_AUDIO, .name = "dsicinaudio", .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_IMC, .type = AVMEDIA_TYPE_AUDIO, .name = "imc", .long_name = NULL_IF_CONFIG_SMALL("IMC (Intel Music Coder)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MUSEPACK7, .type = AVMEDIA_TYPE_AUDIO, .name = "musepack7", .long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MLP, .type = AVMEDIA_TYPE_AUDIO, .name = "mlp", .long_name = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_GSM_MS, .type = AVMEDIA_TYPE_AUDIO, .name = "gsm_ms", .long_name = NULL_IF_CONFIG_SMALL("GSM Microsoft variant"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ATRAC3, .type = AVMEDIA_TYPE_AUDIO, .name = "atrac3", .long_name = NULL_IF_CONFIG_SMALL("Atrac 3 (Adaptive TRansform Acoustic Coding 3)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_VOXWARE, .type = AVMEDIA_TYPE_AUDIO, .name = "voxware", .long_name = NULL_IF_CONFIG_SMALL("Voxware RT29 Metasound"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_APE, .type = AVMEDIA_TYPE_AUDIO, .name = "ape", .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_NELLYMOSER, .type = AVMEDIA_TYPE_AUDIO, .name = "nellymoser", .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MUSEPACK8, .type = AVMEDIA_TYPE_AUDIO, .name = "musepack8", .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_SPEEX, .type = AVMEDIA_TYPE_AUDIO, .name = "speex", .long_name = NULL_IF_CONFIG_SMALL("Speex"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMAVOICE, .type = AVMEDIA_TYPE_AUDIO, .name = "wmavoice", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMAPRO, .type = AVMEDIA_TYPE_AUDIO, .name = "wmapro", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_WMALOSSLESS, .type = AVMEDIA_TYPE_AUDIO, .name = "wmalossless", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_ATRAC3P, .type = AVMEDIA_TYPE_AUDIO, .name = "atrac3p", .long_name = NULL_IF_CONFIG_SMALL("Sony ATRAC3+"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_EAC3, .type = AVMEDIA_TYPE_AUDIO, .name = "eac3", .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_SIPR, .type = AVMEDIA_TYPE_AUDIO, .name = "sipr", .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_MP1, .type = AVMEDIA_TYPE_AUDIO, .name = "mp1", .long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TWINVQ, .type = AVMEDIA_TYPE_AUDIO, .name = "twinvq", .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_TRUEHD, .type = AVMEDIA_TYPE_AUDIO, .name = "truehd", .long_name = NULL_IF_CONFIG_SMALL("TrueHD"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_MP4ALS, .type = AVMEDIA_TYPE_AUDIO, .name = "mp4als", .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Audio Lossless Coding (ALS)"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_ATRAC1, .type = AVMEDIA_TYPE_AUDIO, .name = "atrac1", .long_name = NULL_IF_CONFIG_SMALL("Atrac 1 (Adaptive TRansform Acoustic Coding)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_BINKAUDIO_RDFT, .type = AVMEDIA_TYPE_AUDIO, .name = "binkaudio_rdft", - .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)") + .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_BINKAUDIO_DCT, .type = AVMEDIA_TYPE_AUDIO, .name = "binkaudio_dct", - .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (DCT)") + .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (DCT)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_AAC_LATM, .type = AVMEDIA_TYPE_AUDIO, .name = "aac_latm", .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_QDMC, .type = AVMEDIA_TYPE_AUDIO, .name = "qdmc", .long_name = NULL_IF_CONFIG_SMALL("QDesign Music"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_CELT, .type = AVMEDIA_TYPE_AUDIO, .name = "celt", .long_name = NULL_IF_CONFIG_SMALL("Constrained Energy Lapped Transform (CELT)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_G723_1, .type = AVMEDIA_TYPE_AUDIO, .name = "g723_1", .long_name = NULL_IF_CONFIG_SMALL("G.723.1"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_G729, .type = AVMEDIA_TYPE_AUDIO, .name = "g729", .long_name = NULL_IF_CONFIG_SMALL("G.729"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_8SVX_EXP, .type = AVMEDIA_TYPE_AUDIO, .name = "8svx_exp", .long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_8SVX_FIB, .type = AVMEDIA_TYPE_AUDIO, .name = "8svx_fib", .long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_BMV_AUDIO, .type = AVMEDIA_TYPE_AUDIO, .name = "bmv_audio", .long_name = NULL_IF_CONFIG_SMALL("Discworld II BMV audio"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_RALF, .type = AVMEDIA_TYPE_AUDIO, .name = "ralf", .long_name = NULL_IF_CONFIG_SMALL("RealAudio Lossless"), + .props = AV_CODEC_PROP_LOSSLESS, }, { .id = AV_CODEC_ID_IAC, .type = AVMEDIA_TYPE_AUDIO, .name = "iac", .long_name = NULL_IF_CONFIG_SMALL("IAC (Indeo Audio Coder)"), + .props = AV_CODEC_PROP_LOSSY, }, { .id = AV_CODEC_ID_ILBC, .type = AVMEDIA_TYPE_AUDIO, .name = "ilbc", .long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"), + .props = AV_CODEC_PROP_LOSSY, }, /* subtitle codecs */ diff --git a/libavcodec/version.h b/libavcodec/version.h index a144a3cbb5..78f4ccf17f 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MINOR 26 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ From e2785fa728cc5b0d9939090b4398067a32856a3c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 29 Aug 2012 09:43:20 +0200 Subject: [PATCH 02/12] cmdutils: make -codecs print lossy/lossless flags. --- cmdutils.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index 4462858aa4..9a79d49e12 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -741,13 +741,15 @@ int show_codecs(const char *opt, const char *arg) const AVCodecDescriptor *desc = NULL; printf("Codecs:\n" - " D... = Decoding supported\n" - " .E.. = Encoding supported\n" - " ..V. = Video codec\n" - " ..A. = Audio codec\n" - " ..S. = Subtitle codec\n" - " ...I = Intra frame-only codec\n" - " -----\n"); + " D..... = Decoding supported\n" + " .E.... = Encoding supported\n" + " ..V... = Video codec\n" + " ..A... = Audio codec\n" + " ..S... = Subtitle codec\n" + " ...I.. = Intra frame-only codec\n" + " ....L. = Lossy compression\n" + " .....S = Lossless compression\n" + " -------\n"); while ((desc = avcodec_descriptor_next(desc))) { const AVCodec *codec = NULL; @@ -756,6 +758,8 @@ int show_codecs(const char *opt, const char *arg) printf("%c", get_media_type_char(desc->type)); printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : "."); + printf((desc->props & AV_CODEC_PROP_LOSSY) ? "L" : "."); + printf((desc->props & AV_CODEC_PROP_LOSSLESS) ? "S" : "."); printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : ""); From 038c0b1e06cadffdd6ac50f058dcc6bc075b9019 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 19 Aug 2012 08:29:44 +0200 Subject: [PATCH 03/12] avconv: make the -pass option per-stream. --- Changelog | 3 ++- avconv.h | 2 ++ avconv_opt.c | 13 +++---------- doc/avconv.texi | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Changelog b/Changelog index 4326c688a7..d175c127d7 100644 --- a/Changelog +++ b/Changelog @@ -42,7 +42,8 @@ version : - RTMPE protocol support - RTMPTE protocol support - Canopus Lossless Codec decoder -- avconv -shortest option is now per-output file +- avconv -shortest option is now per-output file, + -pass is now per-output stream - Ut Video encoder diff --git a/avconv.h b/avconv.h index 94b3f670e6..7a51ccbec1 100644 --- a/avconv.h +++ b/avconv.h @@ -158,6 +158,8 @@ typedef struct OptionsContext { int nb_copy_initial_nonkeyframes; SpecifierOpt *filters; int nb_filters; + SpecifierOpt *pass; + int nb_pass; } OptionsContext; typedef struct InputFilter { diff --git a/avconv_opt.c b/avconv_opt.c index 4e483de8ab..28bd926c2f 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -77,7 +77,6 @@ int same_quant = 0; static int file_overwrite = 0; static int video_discard = 0; static int intra_dc_precision = 8; -static int do_pass = 0; static int using_stdin = 0; static int input_sync; @@ -886,6 +885,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL; char *intra_matrix = NULL, *inter_matrix = NULL; const char *filters = "null"; + int do_pass = 0; int i; MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st); @@ -958,6 +958,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) video_enc->intra_dc_precision = intra_dc_precision - 8; /* two pass mode */ + MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st); if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; @@ -1495,14 +1496,6 @@ loop_end: reset_options(o); } -/* same option as mencoder */ -static int opt_pass(const char *opt, const char *arg) -{ - do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 2); - return 0; -} - - static int opt_target(void *optctx, const char *opt, const char *arg) { OptionsContext *o = optctx; @@ -1972,7 +1965,7 @@ const OptionDef options[] = { "force video codec ('copy' to copy stream)", "codec" }, { "same_quant", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &same_quant }, "use same quantizer as source (implies VBR)" }, - { "pass", OPT_VIDEO | HAS_ARG , { opt_pass }, + { "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT, { .off = OFFSET(pass) }, "select the pass number (1 or 2)", "n" }, { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT, { &pass_logfilename_prefix }, "select two pass log file name prefix", "prefix" }, diff --git a/doc/avconv.texi b/doc/avconv.texi index 9f06ddfeb2..58b530c0af 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -479,7 +479,7 @@ Use same quantizer as source (implies VBR). Note that this is NOT SAME QUALITY. Do not use this option unless you know you need it. -@item -pass @var{n} +@item -pass[:@var{stream_specifier}] @var{n} (@emph{output,per-stream}) Select the pass number (1 or 2). It is used to do two-pass video encoding. The statistics of the video are recorded in the first pass into a log file (see also the option -passlogfile), From bbcedade008b5471c71122944cf4dee1951138ec Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 19 Aug 2012 09:15:48 +0200 Subject: [PATCH 04/12] avconv: make the -passlogfile option per-stream. --- Changelog | 2 +- avconv.c | 4 +++- avconv.h | 4 +++- avconv_opt.c | 8 ++++++-- doc/avconv.texi | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index d175c127d7..4fcce0e630 100644 --- a/Changelog +++ b/Changelog @@ -43,7 +43,7 @@ version : - RTMPTE protocol support - Canopus Lossless Codec decoder - avconv -shortest option is now per-output file, - -pass is now per-output stream + -pass and -passlogfile are now per-output stream - Ut Video encoder diff --git a/avconv.c b/avconv.c index 592e9a8aba..0114f4f21f 100644 --- a/avconv.c +++ b/avconv.c @@ -183,6 +183,7 @@ void exit_program(int ret) av_freep(&output_streams[i]->forced_keyframes); av_freep(&output_streams[i]->avfilter); + av_freep(&output_streams[i]->logfile_prefix); av_freep(&output_streams[i]->filtered_frame); av_freep(&output_streams[i]); } @@ -1747,7 +1748,8 @@ static int transcode_init(void) FILE *f; snprintf(logfilename, sizeof(logfilename), "%s-%d.log", - pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX, + ost->logfile_prefix ? ost->logfile_prefix : + DEFAULT_PASS_LOGFILENAME_PREFIX, i); if (!strcmp(ost->enc->name, "libx264")) { av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE); diff --git a/avconv.h b/avconv.h index 7a51ccbec1..2d6f60b451 100644 --- a/avconv.h +++ b/avconv.h @@ -160,6 +160,8 @@ typedef struct OptionsContext { int nb_filters; SpecifierOpt *pass; int nb_pass; + SpecifierOpt *passlogfiles; + int nb_passlogfiles; } OptionsContext; typedef struct InputFilter { @@ -284,6 +286,7 @@ typedef struct OutputStream { int forced_kf_index; char *forced_keyframes; + char *logfile_prefix; FILE *logfile; OutputFilter *filter; @@ -323,7 +326,6 @@ extern int nb_output_files; extern FilterGraph **filtergraphs; extern int nb_filtergraphs; -extern char *pass_logfilename_prefix; extern char *vstats_filename; extern float audio_drift_threshold; diff --git a/avconv_opt.c b/avconv_opt.c index 28bd926c2f..1859af8cf0 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -54,7 +54,6 @@ }\ } -char *pass_logfilename_prefix = NULL; char *vstats_filename; float audio_drift_threshold = 0.1; @@ -967,6 +966,11 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) } } + MATCH_PER_STREAM_OPT(passlogfiles, str, ost->logfile_prefix, oc, st); + if (ost->logfile_prefix && + !(ost->logfile_prefix = av_strdup(ost->logfile_prefix))) + exit_program(1); + MATCH_PER_STREAM_OPT(forced_key_frames, str, ost->forced_keyframes, oc, st); if (ost->forced_keyframes) ost->forced_keyframes = av_strdup(ost->forced_keyframes); @@ -1967,7 +1971,7 @@ const OptionDef options[] = { "use same quantizer as source (implies VBR)" }, { "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT, { .off = OFFSET(pass) }, "select the pass number (1 or 2)", "n" }, - { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT, { &pass_logfilename_prefix }, + { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC, { .off = OFFSET(passlogfiles) }, "select two pass log file name prefix", "prefix" }, { "deinterlace", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_deinterlace }, "this option is deprecated, use the yadif filter instead" }, diff --git a/doc/avconv.texi b/doc/avconv.texi index 58b530c0af..ecf7192817 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -492,7 +492,7 @@ avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null @end example -@item -passlogfile @var{prefix} (@emph{global}) +@item -passlogfile[:@var{stream_specifier}] @var{prefix} (@emph{output,per-stream}) Set two-pass log file name prefix to @var{prefix}, the default file name prefix is ``av2pass''. The complete file name will be @file{PREFIX-N.log}, where N is a number specific to the output From 11d957fbd81288e64408e79ed369446346000b29 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 29 Aug 2012 14:37:22 +0200 Subject: [PATCH 05/12] avtools: remove the distinction between func_arg and func2_arg. func2_arg is the same as func_arg, except it has one additional parameter. Change all func_arg callbacks to take that parameter (and ignore it). --- avconv.c | 2 +- avconv.h | 2 +- avconv_opt.c | 104 +++++++++++++++++++++++++-------------------------- avprobe.c | 8 ++-- cmdutils.c | 35 +++++++++-------- cmdutils.h | 36 +++++++++--------- 6 files changed, 93 insertions(+), 94 deletions(-) diff --git a/avconv.c b/avconv.c index 0114f4f21f..ea736066ec 100644 --- a/avconv.c +++ b/avconv.c @@ -2398,7 +2398,7 @@ static void parse_cpuflags(int argc, char **argv, const OptionDef *options) { int idx = locate_option(argc, argv, options, "cpuflags"); if (idx && argv[idx + 1]) - opt_cpuflags("cpuflags", argv[idx + 1]); + opt_cpuflags(NULL, "cpuflags", argv[idx + 1]); } int main(int argc, char **argv) diff --git a/avconv.h b/avconv.h index 2d6f60b451..bb32836475 100644 --- a/avconv.h +++ b/avconv.h @@ -352,7 +352,7 @@ extern const OptionDef options[]; void reset_options(OptionsContext *o); void show_usage(void); -int opt_cpuflags(const char *opt, const char *arg); +int opt_cpuflags(void *optctx, const char *opt, const char *arg); void opt_output_file(void *optctx, const char *filename); diff --git a/avconv_opt.c b/avconv_opt.c index 1859af8cf0..156073a84b 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -1555,19 +1555,19 @@ static int opt_target(void *optctx, const char *opt, const char *arg) parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options); parse_option(o, "r", frame_rates[norm], options); - opt_default("g", norm == PAL ? "15" : "18"); + opt_default(NULL, "g", norm == PAL ? "15" : "18"); - opt_default("b", "1150000"); - opt_default("maxrate", "1150000"); - opt_default("minrate", "1150000"); - opt_default("bufsize", "327680"); // 40*1024*8; + opt_default(NULL, "b", "1150000"); + opt_default(NULL, "maxrate", "1150000"); + opt_default(NULL, "minrate", "1150000"); + opt_default(NULL, "bufsize", "327680"); // 40*1024*8; - opt_default("b:a", "224000"); + opt_default(NULL, "b:a", "224000"); parse_option(o, "ar", "44100", options); parse_option(o, "ac", "2", options); - opt_default("packetsize", "2324"); - opt_default("muxrate", "1411200"); // 2352 * 75 * 8; + opt_default(NULL, "packetsize", "2324"); + opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8; /* We have to offset the PTS, so that it is consistent with the SCR. SCR starts at 36000, but the first two packs contain only padding @@ -1583,19 +1583,19 @@ static int opt_target(void *optctx, const char *opt, const char *arg) parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options); parse_option(o, "r", frame_rates[norm], options); - opt_default("g", norm == PAL ? "15" : "18"); + opt_default(NULL, "g", norm == PAL ? "15" : "18"); - opt_default("b", "2040000"); - opt_default("maxrate", "2516000"); - opt_default("minrate", "0"); // 1145000; - opt_default("bufsize", "1835008"); // 224*1024*8; - opt_default("flags", "+scan_offset"); + opt_default(NULL, "b", "2040000"); + opt_default(NULL, "maxrate", "2516000"); + opt_default(NULL, "minrate", "0"); // 1145000; + opt_default(NULL, "bufsize", "1835008"); // 224*1024*8; + opt_default(NULL, "flags", "+scan_offset"); - opt_default("b:a", "224000"); + opt_default(NULL, "b:a", "224000"); parse_option(o, "ar", "44100", options); - opt_default("packetsize", "2324"); + opt_default(NULL, "packetsize", "2324"); } else if (!strcmp(arg, "dvd")) { @@ -1605,17 +1605,17 @@ static int opt_target(void *optctx, const char *opt, const char *arg) parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options); parse_option(o, "r", frame_rates[norm], options); - opt_default("g", norm == PAL ? "15" : "18"); + opt_default(NULL, "g", norm == PAL ? "15" : "18"); - opt_default("b", "6000000"); - opt_default("maxrate", "9000000"); - opt_default("minrate", "0"); // 1500000; - opt_default("bufsize", "1835008"); // 224*1024*8; + opt_default(NULL, "b", "6000000"); + opt_default(NULL, "maxrate", "9000000"); + opt_default(NULL, "minrate", "0"); // 1500000; + opt_default(NULL, "bufsize", "1835008"); // 224*1024*8; - opt_default("packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. - opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 + opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. + opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 - opt_default("b:a", "448000"); + opt_default(NULL, "b:a", "448000"); parse_option(o, "ar", "48000", options); } else if (!strncmp(arg, "dv", 2)) { @@ -1637,14 +1637,14 @@ static int opt_target(void *optctx, const char *opt, const char *arg) return 0; } -static int opt_vstats_file(const char *opt, const char *arg) +static int opt_vstats_file(void *optctx, const char *opt, const char *arg) { av_free (vstats_filename); vstats_filename = av_strdup (arg); return 0; } -static int opt_vstats(const char *opt, const char *arg) +static int opt_vstats(void *optctx, const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); @@ -1652,7 +1652,7 @@ static int opt_vstats(const char *opt, const char *arg) snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); - return opt_vstats_file(opt, filename); + return opt_vstats_file(NULL, opt, filename); } static int opt_video_frames(void *optctx, const char *opt, const char *arg) @@ -1703,7 +1703,7 @@ static int opt_audio_filters(void *optctx, const char *opt, const char *arg) return parse_option(o, "filter:a", arg, options); } -static int opt_vsync(const char *opt, const char *arg) +static int opt_vsync(void *optctx, const char *opt, const char *arg) { if (!av_strcasecmp(arg, "cfr")) video_sync_method = VSYNC_CFR; else if (!av_strcasecmp(arg, "vfr")) video_sync_method = VSYNC_VFR; @@ -1714,14 +1714,14 @@ static int opt_vsync(const char *opt, const char *arg) return 0; } -static int opt_deinterlace(const char *opt, const char *arg) +static int opt_deinterlace(void *optctx, const char *opt, const char *arg) { av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -filter:v yadif instead\n", opt); do_deinterlace = 1; return 0; } -int opt_cpuflags(const char *opt, const char *arg) +int opt_cpuflags(void *optctx, const char *opt, const char *arg) { int flags = av_parse_cpu_flags(arg); @@ -1747,7 +1747,7 @@ static int opt_channel_layout(void *optctx, const char *opt, const char *arg) return AVERROR(EINVAL); } snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout); - ret = opt_default(opt, layout_str); + ret = opt_default(NULL, opt, layout_str); if (ret < 0) return ret; @@ -1774,7 +1774,7 @@ static int opt_audio_qscale(void *optctx, const char *opt, const char *arg) return parse_option(o, "q:a", arg, options); } -static int opt_filter_complex(const char *opt, const char *arg) +static int opt_filter_complex(void *optctx, const char *opt, const char *arg) { filtergraphs = grow_array(filtergraphs, sizeof(*filtergraphs), &nb_filtergraphs, nb_filtergraphs + 1); @@ -1788,7 +1788,7 @@ static int opt_filter_complex(const char *opt, const char *arg) void show_help_default(const char *opt, const char *arg) { /* per-file options have at least one of those set */ - const int per_file = OPT_SPEC | OPT_OFFSET | OPT_FUNC2; + const int per_file = OPT_SPEC | OPT_OFFSET | OPT_PERFILE; int show_advanced = 0, show_avoptions = 0; if (opt) { @@ -1863,7 +1863,7 @@ const OptionDef options[] = { #include "cmdutils_common_opts.h" { "f", HAS_ARG | OPT_STRING | OPT_OFFSET, { .off = OFFSET(format) }, "force format", "fmt" }, - { "i", HAS_ARG | OPT_FUNC2, { .func2_arg = opt_input_file }, + { "i", HAS_ARG | OPT_PERFILE, { .func_arg = opt_input_file }, "input file name", "filename" }, { "y", OPT_BOOL, { &file_overwrite }, "overwrite output files" }, @@ -1873,7 +1873,7 @@ const OptionDef options[] = { "codec name", "codec" }, { "pre", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(presets) }, "preset name", "preset" }, - { "map", HAS_ARG | OPT_EXPERT | OPT_FUNC2, { .func2_arg = opt_map }, + { "map", HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_map }, "set input stream mapping", "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" }, { "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(metadata_map) }, @@ -1894,7 +1894,7 @@ const OptionDef options[] = { "set the input ts scale", "scale" }, { "metadata", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(metadata) }, "add metadata", "string=string" }, - { "dframes", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, { .func2_arg = opt_data_frames }, + { "dframes", HAS_ARG | OPT_PERFILE | OPT_EXPERT, { .func_arg = opt_data_frames }, "set the number of data frames to record", "number" }, { "benchmark", OPT_BOOL | OPT_EXPERT, { &do_benchmark }, "add timings for benchmarking" }, @@ -1906,7 +1906,7 @@ const OptionDef options[] = { "when dumping packets, also dump the payload" }, { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(rate_emu) }, "read input at native frame rate", "" }, - { "target", HAS_ARG | OPT_FUNC2, { .func2_arg = opt_target }, + { "target", HAS_ARG | OPT_PERFILE, { .func_arg = opt_target }, "specify target file type (\"vcd\", \"svcd\", \"dvd\"," " \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" }, { "vsync", HAS_ARG | OPT_EXPERT, { opt_vsync }, @@ -1941,7 +1941,7 @@ const OptionDef options[] = { "create a complex filtergraph", "graph_description" }, { "stats", OPT_BOOL, { &print_stats }, "print progress report during encoding", }, - { "attach", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, { .func2_arg = opt_attach }, + { "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT, { .func_arg = opt_attach }, "add an attachment to the output file", "filename" }, { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC |OPT_EXPERT,{ .off = OFFSET(dump_attachment) }, "extract an attachment into a file", "filename" }, @@ -1949,7 +1949,7 @@ const OptionDef options[] = { "set CPU flags mask", "mask" }, /* video options */ - { "vframes", OPT_VIDEO | HAS_ARG | OPT_FUNC2, { .func2_arg = opt_video_frames }, + { "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_video_frames }, "set the number of video frames to record", "number" }, { "r", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(frame_rates) }, "set frame rate (Hz value, fraction or abbreviation)", "rate" }, @@ -1965,7 +1965,7 @@ const OptionDef options[] = { "discard threshold", "n" }, { "rc_override", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC, { .off = OFFSET(rc_overrides) }, "rate control override for specific intervals", "override" }, - { "vcodec", OPT_VIDEO | HAS_ARG | OPT_FUNC2, { .func2_arg = opt_video_codec }, + { "vcodec", OPT_VIDEO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_video_codec }, "force video codec ('copy' to copy stream)", "codec" }, { "same_quant", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &same_quant }, "use same quantizer as source (implies VBR)" }, @@ -1979,7 +1979,7 @@ const OptionDef options[] = { "dump video coding statistics to file" }, { "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { opt_vstats_file }, "dump video coding statistics to file", "file" }, - { "vf", OPT_VIDEO | HAS_ARG | OPT_FUNC2, { .func2_arg = opt_video_filters }, + { "vf", OPT_VIDEO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_video_filters }, "video filters", "filter list" }, { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC, { .off = OFFSET(intra_matrices) }, "specify intra matrix coeffs", "matrix" }, @@ -1989,21 +1989,21 @@ const OptionDef options[] = { "top=1/bottom=0/auto=-1 field first", "" }, { "dc", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &intra_dc_precision }, "intra_dc_precision", "precision" }, - { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_FUNC2, { .func2_arg = opt_video_tag }, + { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_video_tag }, "force video tag/fourcc", "fourcc/tag" }, { "qphist", OPT_VIDEO | OPT_BOOL | OPT_EXPERT , { &qp_hist }, "show QP histogram" }, { "force_fps", OPT_VIDEO | OPT_BOOL | OPT_EXPERT | OPT_SPEC, { .off = OFFSET(force_fps) }, "force the selected framerate, disable the best supported framerate selection" }, - { "streamid", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_FUNC2, { .func2_arg = opt_streamid }, + { "streamid", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_streamid }, "set the value of an outfile streamid", "streamIndex:value" }, { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_SPEC, { .off = OFFSET(forced_key_frames) }, "force key frames at specified timestamps", "timestamps" }, /* audio options */ - { "aframes", OPT_AUDIO | HAS_ARG | OPT_FUNC2, { .func2_arg = opt_audio_frames }, + { "aframes", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_frames }, "set the number of audio frames to record", "number" }, - { "aq", OPT_AUDIO | HAS_ARG | OPT_FUNC2, { .func2_arg = opt_audio_qscale }, + { "aq", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_qscale }, "set audio quality (codec-specific)", "quality", }, { "ar", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC, { .off = OFFSET(audio_sample_rate) }, "set audio sampling rate (in Hz)", "rate" }, @@ -2011,25 +2011,25 @@ const OptionDef options[] = { "set number of audio channels", "channels" }, { "an", OPT_AUDIO | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(audio_disable) }, "disable audio" }, - { "acodec", OPT_AUDIO | HAS_ARG | OPT_FUNC2, { .func2_arg = opt_audio_codec }, + { "acodec", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_codec }, "force audio codec ('copy' to copy stream)", "codec" }, - { "atag", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_FUNC2, { .func2_arg = opt_audio_tag }, + { "atag", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_audio_tag }, "force audio tag/fourcc", "fourcc/tag" }, { "vol", OPT_AUDIO | HAS_ARG | OPT_INT, { &audio_volume }, "change audio volume (256=normal)" , "volume" }, { "sample_fmt", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_STRING, { .off = OFFSET(sample_fmts) }, "set sample format", "format" }, - { "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_FUNC2, { .func2_arg = opt_channel_layout }, + { "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_channel_layout }, "set channel layout", "layout" }, - { "af", OPT_AUDIO | HAS_ARG | OPT_FUNC2, { .func2_arg = opt_audio_filters }, + { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_filters }, "audio filters", "filter list" }, /* subtitle options */ { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) }, "disable subtitle" }, - { "scodec", OPT_SUBTITLE | HAS_ARG | OPT_FUNC2, { .func2_arg = opt_subtitle_codec }, + { "scodec", OPT_SUBTITLE | HAS_ARG | OPT_PERFILE, { .func_arg = opt_subtitle_codec }, "force subtitle codec ('copy' to copy stream)", "codec" }, - { "stag", OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_FUNC2, { .func2_arg = opt_subtitle_tag } + { "stag", OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_subtitle_tag } , "force subtitle tag/fourcc", "fourcc/tag" }, /* grab options */ @@ -2045,7 +2045,7 @@ const OptionDef options[] = { "A comma-separated list of bitstream filters", "bitstream_filters" }, /* data codec support */ - { "dcodec", HAS_ARG | OPT_DATA | OPT_FUNC2 | OPT_EXPERT, { .func2_arg = opt_data_codec }, + { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT, { .func_arg = opt_data_codec }, "force data codec ('copy' to copy stream)", "codec" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { .func_arg = opt_default }, diff --git a/avprobe.c b/avprobe.c index cb610d89f9..b20c78cd34 100644 --- a/avprobe.c +++ b/avprobe.c @@ -794,7 +794,7 @@ static void show_usage(void) printf("\n"); } -static int opt_format(const char *opt, const char *arg) +static int opt_format(void *optctx, const char *opt, const char *arg) { iformat = av_find_input_format(arg); if (!iformat) { @@ -804,7 +804,7 @@ static int opt_format(const char *opt, const char *arg) return 0; } -static int opt_output_format(const char *opt, const char *arg) +static int opt_output_format(void *optctx, const char *opt, const char *arg) { if (!strcmp(arg, "json")) { @@ -838,7 +838,7 @@ static int opt_output_format(const char *opt, const char *arg) return 0; } -static int opt_show_format_entry(const char *opt, const char *arg) +static int opt_show_format_entry(void *optctx, const char *opt, const char *arg) { do_show_format = 1; nb_fmt_entries_to_show++; @@ -877,7 +877,7 @@ void show_help_default(const char *opt, const char *arg) show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); } -static int opt_pretty(const char *opt, const char *arg) +static int opt_pretty(void *optctx, const char *opt, const char *arg) { show_value_unit = 1; use_value_prefix = 1; diff --git a/cmdutils.c b/cmdutils.c index 9a79d49e12..6fb991884f 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -286,8 +286,7 @@ int parse_option(void *optctx, const char *opt, const char *arg, } else if (po->flags & OPT_DOUBLE) { *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY); } else if (po->u.func_arg) { - int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg) - : po->u.func_arg(opt, arg); + int ret = po->u.func_arg(optctx, opt, arg); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", arg, opt); @@ -362,11 +361,11 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) if (!idx) idx = locate_option(argc, argv, options, "v"); if (idx && argv[idx + 1]) - opt_loglevel("loglevel", argv[idx + 1]); + opt_loglevel(NULL, "loglevel", argv[idx + 1]); } #define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 -int opt_default(const char *opt, const char *arg) +int opt_default(void *optctx, const char *opt, const char *arg) { const AVOption *o; char opt_stripped[128]; @@ -401,7 +400,7 @@ int opt_default(const char *opt, const char *arg) return AVERROR_OPTION_NOT_FOUND; } -int opt_loglevel(const char *opt, const char *arg) +int opt_loglevel(void *optctx, const char *opt, const char *arg) { const struct { const char *name; int level; } log_levels[] = { { "quiet" , AV_LOG_QUIET }, @@ -436,7 +435,7 @@ int opt_loglevel(const char *opt, const char *arg) return 0; } -int opt_timelimit(const char *opt, const char *arg) +int opt_timelimit(void *optctx, const char *opt, const char *arg) { #if HAVE_SETRLIMIT int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); @@ -516,7 +515,7 @@ void show_banner(void) print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_VERBOSE); } -int show_version(const char *opt, const char *arg) +int show_version(void *optctx, const char *opt, const char *arg) { av_log_set_callback(log_callback_help); printf("%s " LIBAV_VERSION "\n", program_name); @@ -525,7 +524,7 @@ int show_version(const char *opt, const char *arg) return 0; } -int show_license(const char *opt, const char *arg) +int show_license(void *optctx, const char *opt, const char *arg) { printf( #if CONFIG_NONFREE @@ -596,7 +595,7 @@ int show_license(const char *opt, const char *arg) return 0; } -int show_formats(const char *opt, const char *arg) +int show_formats(void *optctx, const char *opt, const char *arg) { AVInputFormat *ifmt = NULL; AVOutputFormat *ofmt = NULL; @@ -736,7 +735,7 @@ static void print_codecs_for_id(enum AVCodecID id, int encoder) printf(")"); } -int show_codecs(const char *opt, const char *arg) +int show_codecs(void *optctx, const char *opt, const char *arg) { const AVCodecDescriptor *desc = NULL; @@ -815,19 +814,19 @@ static void print_codecs(int encoder) } } -int show_decoders(const char *opt, const char *arg) +int show_decoders(void *optctx, const char *opt, const char *arg) { print_codecs(0); return 0; } -int show_encoders(const char *opt, const char *arg) +int show_encoders(void *optctx, const char *opt, const char *arg) { print_codecs(1); return 0; } -int show_bsfs(const char *opt, const char *arg) +int show_bsfs(void *optctx, const char *opt, const char *arg) { AVBitStreamFilter *bsf = NULL; @@ -838,7 +837,7 @@ int show_bsfs(const char *opt, const char *arg) return 0; } -int show_protocols(const char *opt, const char *arg) +int show_protocols(void *optctx, const char *opt, const char *arg) { void *opaque = NULL; const char *name; @@ -853,7 +852,7 @@ int show_protocols(const char *opt, const char *arg) return 0; } -int show_filters(const char *opt, const char *arg) +int show_filters(void *optctx, const char *opt, const char *arg) { AVFilter av_unused(**filter) = NULL; @@ -865,7 +864,7 @@ int show_filters(const char *opt, const char *arg) return 0; } -int show_pix_fmts(const char *opt, const char *arg) +int show_pix_fmts(void *optctx, const char *opt, const char *arg) { enum PixelFormat pix_fmt; @@ -898,7 +897,7 @@ int show_pix_fmts(const char *opt, const char *arg) return 0; } -int show_sample_fmts(const char *opt, const char *arg) +int show_sample_fmts(void *optctx, const char *opt, const char *arg) { int i; char fmt_str[128]; @@ -993,7 +992,7 @@ static void show_help_muxer(const char *name) show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM); } -int show_help(const char *opt, const char *arg) +int show_help(void *optctx, const char *opt, const char *arg) { char *topic, *par; av_log_set_callback(log_callback_help); diff --git a/cmdutils.h b/cmdutils.h index 212aa71fc6..8e3b80a1db 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -65,17 +65,17 @@ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl); * Fallback for options that are not explicitly handled, these will be * parsed through AVOptions. */ -int opt_default(const char *opt, const char *arg); +int opt_default(void *optctx, const char *opt, const char *arg); /** * Set the libav* libraries log level. */ -int opt_loglevel(const char *opt, const char *arg); +int opt_loglevel(void *optctx, const char *opt, const char *arg); /** * Limit the execution time. */ -int opt_timelimit(const char *opt, const char *arg); +int opt_timelimit(void *optctx, const char *opt, const char *arg); /** * Parse a string and return its corresponding value as a double. @@ -136,7 +136,8 @@ typedef struct { #define OPT_INT64 0x0400 #define OPT_EXIT 0x0800 #define OPT_DATA 0x1000 -#define OPT_FUNC2 0x2000 +#define OPT_PERFILE 0x2000 /* the option is per-file (currently avconv-only). + implied by OPT_OFFSET or OPT_SPEC */ #define OPT_OFFSET 0x4000 /* option is specified as an offset in a passed optctx */ #define OPT_SPEC 0x8000 /* option is to be stored in an array of SpecifierOpt. Implies OPT_OFFSET. Next element after the offset is @@ -145,8 +146,7 @@ typedef struct { #define OPT_DOUBLE 0x20000 union { void *dst_ptr; - int (*func_arg)(const char *, const char *); - int (*func2_arg)(void *, const char *, const char *); + int (*func_arg)(void *, const char *, const char *); size_t off; } u; const char *help; @@ -180,7 +180,7 @@ void show_help_default(const char *opt, const char *arg); /** * Generic -h handler common to all avtools. */ -int show_help(const char *opt, const char *arg); +int show_help(void *optctx, const char *opt, const char *arg); /** * Parse the command line arguments. @@ -277,67 +277,67 @@ void show_banner(void); * depends on the current versions of the repository and of the libav* * libraries. */ -int show_version(const char *opt, const char *arg); +int show_version(void *optctx, const char *opt, const char *arg); /** * Print the license of the program to stdout. The license depends on * the license of the libraries compiled into the program. */ -int show_license(const char *opt, const char *arg); +int show_license(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the formats supported by the * program. */ -int show_formats(const char *opt, const char *arg); +int show_formats(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the codecs supported by the * program. */ -int show_codecs(const char *opt, const char *arg); +int show_codecs(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the decoders supported by the * program. */ -int show_decoders(const char *opt, const char *arg); +int show_decoders(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the encoders supported by the * program. */ -int show_encoders(const char *opt, const char *arg); +int show_encoders(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the filters supported by the * program. */ -int show_filters(const char *opt, const char *arg); +int show_filters(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the bit stream filters supported by the * program. */ -int show_bsfs(const char *opt, const char *arg); +int show_bsfs(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the protocols supported by the * program. */ -int show_protocols(const char *opt, const char *arg); +int show_protocols(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the pixel formats supported by the * program. */ -int show_pix_fmts(const char *opt, const char *arg); +int show_pix_fmts(void *optctx, const char *opt, const char *arg); /** * Print a listing containing all the sample formats supported by the * program. */ -int show_sample_fmts(const char *opt, const char *arg); +int show_sample_fmts(void *optctx, const char *opt, const char *arg); /** * Return a positive value if a line read from standard input From bbefd27e52dfdd2a73bef710602c9978aca4ab7c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 25 Aug 2012 21:34:35 +0000 Subject: [PATCH 06/12] utvideoenc: Avoid writing into the input picture Signed-off-by: Michael Niedermayer --- libavcodec/utvideo.h | 2 +- libavcodec/utvideoenc.c | 66 +++++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/libavcodec/utvideo.h b/libavcodec/utvideo.h index ed6ae86fb9..fe2487c945 100644 --- a/libavcodec/utvideo.h +++ b/libavcodec/utvideo.h @@ -75,7 +75,7 @@ typedef struct UtvideoContext { int interlaced; int frame_pred; - uint8_t *slice_bits, *slice_buffer; + uint8_t *slice_bits, *slice_buffer[4]; int slice_bits_size; } UtvideoContext; diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c index 3e0d66cbde..d99ed0dbd2 100644 --- a/libavcodec/utvideoenc.c +++ b/libavcodec/utvideoenc.c @@ -44,10 +44,12 @@ static int huff_cmp_sym(const void *a, const void *b) static av_cold int utvideo_encode_close(AVCodecContext *avctx) { UtvideoContext *c = avctx->priv_data; + int i; av_freep(&avctx->coded_frame); av_freep(&c->slice_bits); - av_freep(&c->slice_buffer); + for (i = 0; i < 4; i++) + av_freep(&c->slice_buffer[i]); return 0; } @@ -55,7 +57,7 @@ static av_cold int utvideo_encode_close(AVCodecContext *avctx) static av_cold int utvideo_encode_init(AVCodecContext *avctx) { UtvideoContext *c = avctx->priv_data; - + int i; uint32_t original_format; c->avctx = avctx; @@ -142,13 +144,14 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } - c->slice_buffer = av_malloc(avctx->width * avctx->height + - FF_INPUT_BUFFER_PADDING_SIZE); - - if (!c->slice_buffer) { - av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 1.\n"); - utvideo_encode_close(avctx); - return AVERROR(ENOMEM); + for (i = 0; i < c->planes; i++) { + c->slice_buffer[i] = av_malloc(avctx->width * (avctx->height + 1) + + FF_INPUT_BUFFER_PADDING_SIZE); + if (!c->slice_buffer[i]) { + av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 1.\n"); + utvideo_encode_close(avctx); + return AVERROR(ENOMEM); + } } /* @@ -193,20 +196,33 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) return 0; } -static void mangle_rgb_planes(uint8_t *src, int step, int stride, int width, - int height) +static void mangle_rgb_planes(uint8_t *dst[4], uint8_t *src, int step, + int stride, int width, int height) { int i, j; - uint8_t r, g, b; + int k = width; + unsigned int g; for (j = 0; j < height; j++) { - for (i = 0; i < width * step; i += step) { - r = src[i]; - g = src[i + 1]; - b = src[i + 2]; - - src[i] = r - g + 0x80; - src[i + 2] = b - g + 0x80; + if (step == 3) { + for (i = 0; i < width * step; i += step) { + g = src[i + 1]; + dst[0][k] = g; + g += 0x80; + dst[1][k] = src[i + 2] - g; + dst[2][k] = src[i + 0] - g; + k++; + } + } else { + for (i = 0; i < width * step; i += step) { + g = src[i + 1]; + dst[0][k] = g; + g += 0x80; + dst[1][k] = src[i + 2] - g; + dst[2][k] = src[i + 0] - g; + dst[3][k] = src[i + 3]; + k++; + } } src += stride; } @@ -535,16 +551,16 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, /* In case of RGB, mangle the planes to Ut Video's format */ if (avctx->pix_fmt == PIX_FMT_RGBA || avctx->pix_fmt == PIX_FMT_RGB24) - mangle_rgb_planes(pic->data[0], c->planes, pic->linesize[0], width, - height); + mangle_rgb_planes(c->slice_buffer, pic->data[0], c->planes, + pic->linesize[0], width, height); /* Deal with the planes */ switch (avctx->pix_fmt) { case PIX_FMT_RGB24: case PIX_FMT_RGBA: for (i = 0; i < c->planes; i++) { - ret = encode_plane(avctx, pic->data[0] + ff_ut_rgb_order[i], - c->slice_buffer, c->planes, pic->linesize[0], + ret = encode_plane(avctx, c->slice_buffer[i] + width, + c->slice_buffer[i], 1, width, width, height, &pb); if (ret) { @@ -555,7 +571,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, break; case PIX_FMT_YUV422P: for (i = 0; i < c->planes; i++) { - ret = encode_plane(avctx, pic->data[i], c->slice_buffer, 1, + ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], 1, pic->linesize[i], width >> !!i, height, &pb); if (ret) { @@ -566,7 +582,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, break; case PIX_FMT_YUV420P: for (i = 0; i < c->planes; i++) { - ret = encode_plane(avctx, pic->data[i], c->slice_buffer, 1, + ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], 1, pic->linesize[i], width >> !!i, height >> !!i, &pb); From 040405b59efeb3bdc44accdfb93841e7fed5f6be Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 25 Aug 2012 21:34:39 +0000 Subject: [PATCH 07/12] utvideoenc: Switch to dsputils' median prediction Also, align the mangled RGB planes, which is required for the SIMD versions of dsputils' median predict. Signed-off-by: Michael Niedermayer --- libavcodec/utvideo.h | 1 + libavcodec/utvideoenc.c | 68 +++++++++++++++++------------------------ 2 files changed, 29 insertions(+), 40 deletions(-) diff --git a/libavcodec/utvideo.h b/libavcodec/utvideo.h index fe2487c945..0d7664c822 100644 --- a/libavcodec/utvideo.h +++ b/libavcodec/utvideo.h @@ -75,6 +75,7 @@ typedef struct UtvideoContext { int interlaced; int frame_pred; + int slice_stride; uint8_t *slice_bits, *slice_buffer[4]; int slice_bits_size; } UtvideoContext; diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c index d99ed0dbd2..335e79b4a8 100644 --- a/libavcodec/utvideoenc.c +++ b/libavcodec/utvideoenc.c @@ -62,6 +62,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) c->avctx = avctx; c->frame_info_size = 4; + c->slice_stride = FFALIGN(avctx->width, 32); switch (avctx->pix_fmt) { case PIX_FMT_RGB24: @@ -145,7 +146,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) } for (i = 0; i < c->planes; i++) { - c->slice_buffer[i] = av_malloc(avctx->width * (avctx->height + 1) + + c->slice_buffer[i] = av_malloc(c->slice_stride * (avctx->height + 2) + FF_INPUT_BUFFER_PADDING_SIZE); if (!c->slice_buffer[i]) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 1.\n"); @@ -196,11 +197,11 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) return 0; } -static void mangle_rgb_planes(uint8_t *dst[4], uint8_t *src, int step, - int stride, int width, int height) +static void mangle_rgb_planes(uint8_t *dst[4], int dst_stride, uint8_t *src, + int step, int stride, int width, int height) { int i, j; - int k = width; + int k = 2 * dst_stride; unsigned int g; for (j = 0; j < height; j++) { @@ -224,18 +225,19 @@ static void mangle_rgb_planes(uint8_t *dst[4], uint8_t *src, int step, k++; } } + k += dst_stride - width; src += stride; } } /* Write data to a plane, no prediction applied */ -static void write_plane(uint8_t *src, uint8_t *dst, int step, int stride, +static void write_plane(uint8_t *src, uint8_t *dst, int stride, int width, int height) { int i, j; for (j = 0; j < height; j++) { - for (i = 0; i < width * step; i += step) + for (i = 0; i < width; i++) *dst++ = src[i]; src += stride; @@ -243,7 +245,7 @@ static void write_plane(uint8_t *src, uint8_t *dst, int step, int stride, } /* Write data to a plane with left prediction */ -static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride, +static void left_predict(uint8_t *src, uint8_t *dst, int stride, int width, int height) { int i, j; @@ -251,7 +253,7 @@ static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride, prev = 0x80; /* Set the initial value */ for (j = 0; j < height; j++) { - for (i = 0; i < width * step; i += step) { + for (i = 0; i < width; i++) { *dst++ = src[i] - prev; prev = src[i]; } @@ -260,16 +262,16 @@ static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride, } /* Write data to a plane with median prediction */ -static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride, +static void median_predict(UtvideoContext *c, uint8_t *src, uint8_t *dst, int stride, int width, int height) { int i, j; - int A, B, C; + int A, B; uint8_t prev; /* First line uses left neighbour prediction */ prev = 0x80; /* Set the initial value */ - for (i = 0; i < width * step; i += step) { + for (i = 0; i < width; i++) { *dst++ = src[i] - prev; prev = src[i]; } @@ -283,26 +285,12 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride, * Second line uses top prediction for the first sample, * and median for the rest. */ - C = src[-stride]; - *dst++ = src[0] - C; - A = src[0]; - for (i = step; i < width * step; i += step) { - B = src[i - stride]; - *dst++ = src[i] - mid_pred(A, B, (A + B - C) & 0xFF); - C = B; - A = src[i]; - } - - src += stride; + A = B = 0; /* Rest of the coded part uses median prediction */ - for (j = 2; j < height; j++) { - for (i = 0; i < width * step; i += step) { - B = src[i - stride]; - *dst++ = src[i] - mid_pred(A, B, (A + B - C) & 0xFF); - C = B; - A = src[i]; - } + for (j = 1; j < height; j++) { + c->dsp.sub_hfyu_median_prediction(dst, src - stride, src, width, &A, &B); + dst += width; src += stride; } } @@ -376,7 +364,7 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size, } static int encode_plane(AVCodecContext *avctx, uint8_t *src, - uint8_t *dst, int step, int stride, + uint8_t *dst, int stride, int width, int height, PutByteContext *pb) { UtvideoContext *c = avctx->priv_data; @@ -396,7 +384,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src, sstart = send; send = height * (i + 1) / c->slices; write_plane(src + sstart * stride, dst + sstart * width, - step, stride, width, send - sstart); + stride, width, send - sstart); } break; case PRED_LEFT: @@ -404,15 +392,15 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src, sstart = send; send = height * (i + 1) / c->slices; left_predict(src + sstart * stride, dst + sstart * width, - step, stride, width, send - sstart); + stride, width, send - sstart); } break; case PRED_MEDIAN: for (i = 0; i < c->slices; i++) { sstart = send; send = height * (i + 1) / c->slices; - median_predict(src + sstart * stride, dst + sstart * width, - step, stride, width, send - sstart); + median_predict(c, src + sstart * stride, dst + sstart * width, + stride, width, send - sstart); } break; default: @@ -551,16 +539,16 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, /* In case of RGB, mangle the planes to Ut Video's format */ if (avctx->pix_fmt == PIX_FMT_RGBA || avctx->pix_fmt == PIX_FMT_RGB24) - mangle_rgb_planes(c->slice_buffer, pic->data[0], c->planes, - pic->linesize[0], width, height); + mangle_rgb_planes(c->slice_buffer, c->slice_stride, pic->data[0], + c->planes, pic->linesize[0], width, height); /* Deal with the planes */ switch (avctx->pix_fmt) { case PIX_FMT_RGB24: case PIX_FMT_RGBA: for (i = 0; i < c->planes; i++) { - ret = encode_plane(avctx, c->slice_buffer[i] + width, - c->slice_buffer[i], 1, width, + ret = encode_plane(avctx, c->slice_buffer[i] + 2 * c->slice_stride, + c->slice_buffer[i], c->slice_stride, width, height, &pb); if (ret) { @@ -571,7 +559,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, break; case PIX_FMT_YUV422P: for (i = 0; i < c->planes; i++) { - ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], 1, + ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], pic->linesize[i], width >> !!i, height, &pb); if (ret) { @@ -582,7 +570,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, break; case PIX_FMT_YUV420P: for (i = 0; i < c->planes; i++) { - ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], 1, + ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], pic->linesize[i], width >> !!i, height >> !!i, &pb); From 04fc5c6bde5da842e8b40a9a76eb72c8327ae40b Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 23 Aug 2012 19:51:11 +0200 Subject: [PATCH 08/12] g723_1: add comfort noise generation --- libavcodec/g723_1.c | 226 ++++++++++++++++++++++++++++++++++-- libavcodec/g723_1_data.h | 6 + tests/fate/voice.mak | 6 + tests/ref/fate/g723_1-dec-7 | 12 ++ tests/ref/fate/g723_1-dec-8 | 121 +++++++++++++++++++ 5 files changed, 364 insertions(+), 7 deletions(-) create mode 100644 tests/ref/fate/g723_1-dec-7 create mode 100644 tests/ref/fate/g723_1-dec-8 diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c index 793b2d3dd9..03dd62d46a 100644 --- a/libavcodec/g723_1.c +++ b/libavcodec/g723_1.c @@ -35,6 +35,8 @@ #include "celp_filters.h" #include "g723_1_data.h" +#define CNG_RANDOM_SEED 12345 + /** * G723.1 frame types */ @@ -84,6 +86,7 @@ typedef struct g723_1_context { int erased_frames; int16_t prev_lsp[LPC_ORDER]; + int16_t sid_lsp[LPC_ORDER]; int16_t prev_excitation[PITCH_MAX]; int16_t excitation[PITCH_MAX + FRAME_LEN + 4]; int16_t synth_mem[LPC_ORDER]; @@ -91,6 +94,7 @@ typedef struct g723_1_context { int iir_mem[LPC_ORDER]; int random_seed; + int cng_random_seed; int interp_index; int interp_gain; int sid_gain; @@ -99,7 +103,7 @@ typedef struct g723_1_context { int pf_gain; int postfilter; - int16_t audio[FRAME_LEN + LPC_ORDER + PITCH_MAX]; + int16_t audio[FRAME_LEN + LPC_ORDER + PITCH_MAX + 4]; } G723_1_Context; static av_cold int g723_1_decode_init(AVCodecContext *avctx) @@ -116,6 +120,10 @@ static av_cold int g723_1_decode_init(AVCodecContext *avctx) avctx->coded_frame = &p->frame; memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(*p->prev_lsp)); + memcpy(p->sid_lsp, dc_lsp, LPC_ORDER * sizeof(*p->sid_lsp)); + + p->cng_random_seed = CNG_RANDOM_SEED; + p->past_frame_type = SID_FRAME; return 0; } @@ -983,6 +991,201 @@ static void formant_postfilter(G723_1_Context *p, int16_t *lpc, } } +static int sid_gain_to_lsp_index(int gain) +{ + if (gain < 0x10) + return gain << 6; + else if (gain < 0x20) + return gain - 8 << 7; + else + return gain - 20 << 8; +} + +static inline int cng_rand(int *state, int base) +{ + *state = (*state * 521 + 259) & 0xFFFF; + return (*state & 0x7FFF) * base >> 15; +} + +static int estimate_sid_gain(G723_1_Context *p) +{ + int i, shift, seg, seg2, t, val, val_add, x, y; + + shift = 16 - p->cur_gain * 2; + if (shift > 0) + t = p->sid_gain << shift; + else + t = p->sid_gain >> -shift; + x = t * cng_filt[0] >> 16; + + if (x >= cng_bseg[2]) + return 0x3F; + + if (x >= cng_bseg[1]) { + shift = 4; + seg = 3; + } else { + shift = 3; + seg = (x >= cng_bseg[0]); + } + seg2 = FFMIN(seg, 3); + + val = 1 << shift; + val_add = val >> 1; + for (i = 0; i < shift; i++) { + t = seg * 32 + (val << seg2); + t *= t; + if (x >= t) + val += val_add; + else + val -= val_add; + val_add >>= 1; + } + + t = seg * 32 + (val << seg2); + y = t * t - x; + if (y <= 0) { + t = seg * 32 + (val + 1 << seg2); + t = t * t - x; + val = (seg2 - 1 << 4) + val; + if (t >= y) + val++; + } else { + t = seg * 32 + (val - 1 << seg2); + t = t * t - x; + val = (seg2 - 1 << 4) + val; + if (t >= y) + val--; + } + + return val; +} + +static void generate_noise(G723_1_Context *p) +{ + int i, j, idx, t; + int off[SUBFRAMES]; + int signs[SUBFRAMES / 2 * 11], pos[SUBFRAMES / 2 * 11]; + int tmp[SUBFRAME_LEN * 2]; + int16_t *vector_ptr; + int64_t sum; + int b0, c, delta, x, shift; + + p->pitch_lag[0] = cng_rand(&p->cng_random_seed, 21) + 123; + p->pitch_lag[1] = cng_rand(&p->cng_random_seed, 19) + 123; + + for (i = 0; i < SUBFRAMES; i++) { + p->subframe[i].ad_cb_gain = cng_rand(&p->cng_random_seed, 50) + 1; + p->subframe[i].ad_cb_lag = cng_adaptive_cb_lag[i]; + } + + for (i = 0; i < SUBFRAMES / 2; i++) { + t = cng_rand(&p->cng_random_seed, 1 << 13); + off[i * 2] = t & 1; + off[i * 2 + 1] = ((t >> 1) & 1) + SUBFRAME_LEN; + t >>= 2; + for (j = 0; j < 11; j++) { + signs[i * 11 + j] = (t & 1) * 2 - 1 << 14; + t >>= 1; + } + } + + idx = 0; + for (i = 0; i < SUBFRAMES; i++) { + for (j = 0; j < SUBFRAME_LEN / 2; j++) + tmp[j] = j; + t = SUBFRAME_LEN / 2; + for (j = 0; j < pulses[i]; j++, idx++) { + int idx2 = cng_rand(&p->cng_random_seed, t); + + pos[idx] = tmp[idx2] * 2 + off[i]; + tmp[idx2] = tmp[--t]; + } + } + + vector_ptr = p->audio + LPC_ORDER; + memcpy(vector_ptr, p->prev_excitation, + PITCH_MAX * sizeof(*p->excitation)); + for (i = 0; i < SUBFRAMES; i += 2) { + gen_acb_excitation(vector_ptr, vector_ptr, + p->pitch_lag[i >> 1], &p->subframe[i], + p->cur_rate); + gen_acb_excitation(vector_ptr + SUBFRAME_LEN, + vector_ptr + SUBFRAME_LEN, + p->pitch_lag[i >> 1], &p->subframe[i + 1], + p->cur_rate); + + t = 0; + for (j = 0; j < SUBFRAME_LEN * 2; j++) + t |= FFABS(vector_ptr[j]); + t = FFMIN(t, 0x7FFF); + if (!t) { + shift = 0; + } else { + shift = -10 + av_log2(t); + if (shift < -2) + shift = -2; + } + sum = 0; + if (shift < 0) { + for (j = 0; j < SUBFRAME_LEN * 2; j++) { + t = vector_ptr[j] << -shift; + sum += t * t; + tmp[j] = t; + } + } else { + for (j = 0; j < SUBFRAME_LEN * 2; j++) { + t = vector_ptr[j] >> shift; + sum += t * t; + tmp[j] = t; + } + } + + b0 = 0; + for (j = 0; j < 11; j++) + b0 += tmp[pos[(i / 2) * 11 + j]] * signs[(i / 2) * 11 + j]; + b0 = b0 * 2 * 2979LL + (1 << 29) >> 30; // approximated division by 11 + + c = p->cur_gain * (p->cur_gain * SUBFRAME_LEN >> 5); + if (shift * 2 + 3 >= 0) + c >>= shift * 2 + 3; + else + c <<= -(shift * 2 + 3); + c = (av_clipl_int32(sum << 1) - c) * 2979LL >> 15; + + delta = b0 * b0 * 2 - c; + if (delta <= 0) { + x = -b0; + } else { + delta = square_root(delta); + x = delta - b0; + t = delta + b0; + if (FFABS(t) < FFABS(x)) + x = -t; + } + shift++; + if (shift < 0) + x >>= -shift; + else + x <<= shift; + x = av_clip(x, -10000, 10000); + + for (j = 0; j < 11; j++) { + idx = (i / 2) * 11 + j; + vector_ptr[pos[idx]] = av_clip_int16(vector_ptr[pos[idx]] + + (x * signs[idx] >> 15)); + } + + /* copy decoded data to serve as a history for the next decoded subframes */ + memcpy(vector_ptr + PITCH_MAX, vector_ptr, + sizeof(*vector_ptr) * SUBFRAME_LEN * 2); + vector_ptr += SUBFRAME_LEN * 2; + } + /* Save the excitation for the next frame */ + memcpy(p->prev_excitation, p->audio + LPC_ORDER + FRAME_LEN, + PITCH_MAX * sizeof(*p->excitation)); +} + static int g723_1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { @@ -1107,14 +1310,23 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data, PITCH_MAX * sizeof(*p->excitation)); } } + p->cng_random_seed = CNG_RANDOM_SEED; } else { - memset(out, 0, FRAME_LEN * 2); - av_log(avctx, AV_LOG_WARNING, - "G.723.1: Comfort noise generation not supported yet\n"); + if (p->cur_frame_type == SID_FRAME) { + p->sid_gain = sid_gain_to_lsp_index(p->subframe[0].amp_index); + inverse_quant(p->sid_lsp, p->prev_lsp, p->lsp_index, 0); + } else if (p->past_frame_type == ACTIVE_FRAME) { + p->sid_gain = estimate_sid_gain(p); + } - *got_frame_ptr = 1; - *(AVFrame *)data = p->frame; - return frame_size[dec_mode]; + if (p->past_frame_type == ACTIVE_FRAME) + p->cur_gain = p->sid_gain; + else + p->cur_gain = (p->cur_gain * 7 + p->sid_gain) >> 3; + generate_noise(p); + lsp_interpolate(lpc, p->sid_lsp, p->prev_lsp); + /* Save the lsp_vector for the next frame */ + memcpy(p->prev_lsp, p->sid_lsp, LPC_ORDER * sizeof(*p->prev_lsp)); } p->past_frame_type = p->cur_frame_type; diff --git a/libavcodec/g723_1_data.h b/libavcodec/g723_1_data.h index 82446b3da0..04f8a06e37 100644 --- a/libavcodec/g723_1_data.h +++ b/libavcodec/g723_1_data.h @@ -1191,4 +1191,10 @@ static const int16_t postfilter_tbl[2][LPC_ORDER] = { { 24576, 18432, 13824, 10368, 7776, 5832, 4374, 3281, 2460, 1845 } }; +static const int cng_adaptive_cb_lag[4] = { 1, 0, 1, 3 }; + +static const int cng_filt[4] = { 273, 998, 499, 333 }; + +static const int cng_bseg[3] = { 2048, 18432, 231233 }; + #endif /* AVCODEC_G723_1_DATA_H */ diff --git a/tests/fate/voice.mak b/tests/fate/voice.mak index ea765d2e39..b9b8aa6aae 100644 --- a/tests/fate/voice.mak +++ b/tests/fate/voice.mak @@ -27,6 +27,12 @@ fate-g723_1-dec-5: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/pathd63p.tc FATE_G723_1 += fate-g723_1-dec-6 fate-g723_1-dec-6: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/tamed63p.tco +FATE_G723_1 += fate-g723_1-dec-7 +fate-g723_1-dec-7: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/dtx63b.tco + +FATE_G723_1 += fate-g723_1-dec-8 +fate-g723_1-dec-8: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/dtx63e.tco + FATE_SAMPLES_AVCONV += $(FATE_G723_1) fate-g723_1: $(FATE_G723_1) diff --git a/tests/ref/fate/g723_1-dec-7 b/tests/ref/fate/g723_1-dec-7 new file mode 100644 index 0000000000..cc301873cb --- /dev/null +++ b/tests/ref/fate/g723_1-dec-7 @@ -0,0 +1,12 @@ +#tb 0: 1/8000 +0, 0, 0, 240, 480, 0x35e4a1fd +0, 240, 240, 240, 480, 0x2f7bdd60 +0, 480, 480, 240, 480, 0x0407e499 +0, 720, 720, 240, 480, 0x5f5ef209 +0, 960, 960, 240, 480, 0xe936e8d1 +0, 1200, 1200, 240, 480, 0x0896ddba +0, 1440, 1440, 240, 480, 0xa885ea94 +0, 1680, 1680, 240, 480, 0x40bff3d0 +0, 1920, 1920, 240, 480, 0xe05ce4c3 +0, 2160, 2160, 240, 480, 0x80c4f790 +0, 2400, 2400, 240, 480, 0x65d5e8f9 diff --git a/tests/ref/fate/g723_1-dec-8 b/tests/ref/fate/g723_1-dec-8 new file mode 100644 index 0000000000..fc4d9f3977 --- /dev/null +++ b/tests/ref/fate/g723_1-dec-8 @@ -0,0 +1,121 @@ +#tb 0: 1/8000 +0, 0, 0, 240, 480, 0x17930e0f +0, 240, 240, 240, 480, 0x7c7f4247 +0, 480, 480, 240, 480, 0xbf3489e5 +0, 720, 720, 240, 480, 0x24319fc9 +0, 960, 960, 240, 480, 0xb327eec0 +0, 1200, 1200, 240, 480, 0xc2ddcbca +0, 1440, 1440, 240, 480, 0xeebad740 +0, 1680, 1680, 240, 480, 0x77fcb933 +0, 1920, 1920, 240, 480, 0x9677c5b7 +0, 2160, 2160, 240, 480, 0xb49dcb9e +0, 2400, 2400, 240, 480, 0x0e78d7e6 +0, 2640, 2640, 240, 480, 0xf752dc3e +0, 2880, 2880, 240, 480, 0xc95af091 +0, 3120, 3120, 240, 480, 0xa25de399 +0, 3360, 3360, 240, 480, 0x34e7e0da +0, 3600, 3600, 240, 480, 0x6c84e3f4 +0, 3840, 3840, 240, 480, 0x2c7dda20 +0, 4080, 4080, 240, 480, 0x00a5f112 +0, 4320, 4320, 240, 480, 0x943ddd89 +0, 4560, 4560, 240, 480, 0x4ad4ebac +0, 4800, 4800, 240, 480, 0xa4ff0aa8 +0, 5040, 5040, 240, 480, 0xc0f805f2 +0, 5280, 5280, 240, 480, 0x859ce987 +0, 5520, 5520, 240, 480, 0x9ebcd0de +0, 5760, 5760, 240, 480, 0x3de2db0b +0, 6000, 6000, 240, 480, 0x0affea9c +0, 6240, 6240, 240, 480, 0xcb1bf81e +0, 6480, 6480, 240, 480, 0x8a72d71d +0, 6720, 6720, 240, 480, 0x583cd5cd +0, 6960, 6960, 240, 480, 0x4be7dc7b +0, 7200, 7200, 240, 480, 0xb08108c0 +0, 7440, 7440, 240, 480, 0xd0b3ed59 +0, 7680, 7680, 240, 480, 0x7d33f822 +0, 7920, 7920, 240, 480, 0x199c0111 +0, 8160, 8160, 240, 480, 0x7d29f2a8 +0, 8400, 8400, 240, 480, 0x424dec5e +0, 8640, 8640, 240, 480, 0x946cf258 +0, 8880, 8880, 240, 480, 0xd429da7a +0, 9120, 9120, 240, 480, 0x0f11df46 +0, 9360, 9360, 240, 480, 0xf4dce502 +0, 9600, 9600, 240, 480, 0x01c1de78 +0, 9840, 9840, 240, 480, 0xd1d3da59 +0, 10080, 10080, 240, 480, 0x5822f3ec +0, 10320, 10320, 240, 480, 0xadd5fe67 +0, 10560, 10560, 240, 480, 0xdcf5f2c3 +0, 10800, 10800, 240, 480, 0x5176e39b +0, 11040, 11040, 240, 480, 0xf947e0b1 +0, 11280, 11280, 240, 480, 0x33b1eb36 +0, 11520, 11520, 240, 480, 0x57bce9bd +0, 11760, 11760, 240, 480, 0x806eec1f +0, 12000, 12000, 240, 480, 0x0a60f94a +0, 12240, 12240, 240, 480, 0x9eddf27d +0, 12480, 12480, 240, 480, 0x3d28ef2f +0, 12720, 12720, 240, 480, 0x52f0e562 +0, 12960, 12960, 240, 480, 0xf2d6c8a0 +0, 13200, 13200, 240, 480, 0xfa0df4a1 +0, 13440, 13440, 240, 480, 0x9cccfda9 +0, 13680, 13680, 240, 480, 0xa7c1e528 +0, 13920, 13920, 240, 480, 0xe130e8f9 +0, 14160, 14160, 240, 480, 0x80f6eabe +0, 14400, 14400, 240, 480, 0x9bbb027e +0, 14640, 14640, 240, 480, 0x33cdea7f +0, 14880, 14880, 240, 480, 0x84d8e761 +0, 15120, 15120, 240, 480, 0xb99ce457 +0, 15360, 15360, 240, 480, 0x5dc1e324 +0, 15600, 15600, 240, 480, 0xc914e6c3 +0, 15840, 15840, 240, 480, 0x8e77f5c2 +0, 16080, 16080, 240, 480, 0x3997034d +0, 16320, 16320, 240, 480, 0x820cfd49 +0, 16560, 16560, 240, 480, 0x8ad5f24c +0, 16800, 16800, 240, 480, 0xe21be71c +0, 17040, 17040, 240, 480, 0x516ae8c8 +0, 17280, 17280, 240, 480, 0x595bdc3d +0, 17520, 17520, 240, 480, 0x8a4bee79 +0, 17760, 17760, 240, 480, 0x307fed64 +0, 18000, 18000, 240, 480, 0xe71cf219 +0, 18240, 18240, 240, 480, 0xdb0be1a1 +0, 18480, 18480, 240, 480, 0x7947dfbd +0, 18720, 18720, 240, 480, 0x5d90fbf0 +0, 18960, 18960, 240, 480, 0xa449fc55 +0, 19200, 19200, 240, 480, 0x45b2f979 +0, 19440, 19440, 240, 480, 0x2b2be378 +0, 19680, 19680, 240, 480, 0x2d2edf42 +0, 19920, 19920, 240, 480, 0x568ee04f +0, 20160, 20160, 240, 480, 0x66f0debe +0, 20400, 20400, 240, 480, 0xc943eab7 +0, 20640, 20640, 240, 480, 0xc9ade3c9 +0, 20880, 20880, 240, 480, 0x6971f92d +0, 21120, 21120, 240, 480, 0x48d0ecbc +0, 21360, 21360, 240, 480, 0xf641dc98 +0, 21600, 21600, 240, 480, 0xbb18e167 +0, 21840, 21840, 240, 480, 0x72ce0968 +0, 22080, 22080, 240, 480, 0x15bee6f6 +0, 22320, 22320, 240, 480, 0x93d5e91f +0, 22560, 22560, 240, 480, 0x7aee010b +0, 22800, 22800, 240, 480, 0x9e82dc87 +0, 23040, 23040, 240, 480, 0x4ee6f547 +0, 23280, 23280, 240, 480, 0x3072d102 +0, 23520, 23520, 240, 480, 0x74d4fb04 +0, 23760, 23760, 240, 480, 0xc670f958 +0, 24000, 24000, 240, 480, 0x3965c41f +0, 24240, 24240, 240, 480, 0x6a2de869 +0, 24480, 24480, 240, 480, 0xa757f44b +0, 24720, 24720, 240, 480, 0x94a5168c +0, 24960, 24960, 240, 480, 0xef0f0c28 +0, 25200, 25200, 240, 480, 0x3770ebb3 +0, 25440, 25440, 240, 480, 0x4343de6f +0, 25680, 25680, 240, 480, 0x3ec8d816 +0, 25920, 25920, 240, 480, 0x1661e3d3 +0, 26160, 26160, 240, 480, 0x077cd9fd +0, 26400, 26400, 240, 480, 0xb5ece07e +0, 26640, 26640, 240, 480, 0xf303e151 +0, 26880, 26880, 240, 480, 0x95e4d019 +0, 27120, 27120, 240, 480, 0x4bd0ddc0 +0, 27360, 27360, 240, 480, 0x6cebd341 +0, 27600, 27600, 240, 480, 0xea3fea9e +0, 27840, 27840, 240, 480, 0x5ad30c3f +0, 28080, 28080, 240, 480, 0x218c02a5 +0, 28320, 28320, 240, 480, 0x662decd0 +0, 28560, 28560, 240, 480, 0x6865e2f2 From a886b279a0f309b83b28612eb7661402cb1e41ef Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 29 Aug 2012 15:05:53 +0200 Subject: [PATCH 09/12] x86: cosmetics: Comment some #endifs for better readability --- libavcodec/x86/dsputil_mmx.c | 10 +++++----- libavcodec/x86/fmtconvert_init.c | 4 ++-- libavcodec/x86/rv34dsp_init.c | 2 +- libavcodec/x86/rv40dsp_init.c | 2 +- libavcodec/x86/vc1dsp_mmx.c | 5 ++--- libavcodec/x86/vp8dsp_init.c | 4 ++-- libavresample/x86/audio_mix_init.c | 2 +- libavutil/x86/cpu.c | 4 ++-- libswscale/x86/swscale.c | 2 +- 9 files changed, 17 insertions(+), 18 deletions(-) diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index c1f54ac64f..4fbb146ccc 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2692,7 +2692,7 @@ static void dsputil_init_mmx2(DSPContext *c, AVCodecContext *avctx, #endif SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 10_mmxext, ff_); SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 10_mmxext, ff_); -#endif +#endif /* HAVE_YASM */ } #if HAVE_INLINE_ASM @@ -2727,7 +2727,7 @@ static void dsputil_init_mmx2(DSPContext *c, AVCodecContext *avctx, } else { c->apply_window_int16 = ff_apply_window_int16_mmxext; } -#endif +#endif /* HAVE_YASM */ } static void dsputil_init_3dnow(DSPContext *c, AVCodecContext *avctx, @@ -2806,7 +2806,7 @@ static void dsputil_init_3dnow(DSPContext *c, AVCodecContext *avctx, c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_3dnow_rnd; c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_3dnow; } -#endif +#endif /* HAVE_YASM */ } static void dsputil_init_3dnowext(DSPContext *c, AVCodecContext *avctx, @@ -2852,7 +2852,7 @@ static void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx, int mm_flags) #if HAVE_INLINE_ASM c->gmc = gmc_sse; #endif -#endif +#endif /* HAVE_YASM */ } static void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx, @@ -2920,7 +2920,7 @@ static void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx, c->apply_window_int16 = ff_apply_window_int16_sse2; } c->bswap_buf = ff_bswap32_buf_sse2; -#endif +#endif /* HAVE_YASM */ } static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx, diff --git a/libavcodec/x86/fmtconvert_init.c b/libavcodec/x86/fmtconvert_init.c index 6f3d14aedc..e781adbd41 100644 --- a/libavcodec/x86/fmtconvert_init.c +++ b/libavcodec/x86/fmtconvert_init.c @@ -110,7 +110,7 @@ static void float_interleave_sse(float *dst, const float **src, else ff_float_interleave_c(dst, src, len, channels); } -#endif +#endif /* HAVE_YASM */ void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx) { @@ -143,5 +143,5 @@ void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx) c->float_to_int16_interleave = float_to_int16_interleave_sse2; } } -#endif +#endif /* HAVE_YASM */ } diff --git a/libavcodec/x86/rv34dsp_init.c b/libavcodec/x86/rv34dsp_init.c index b07ad89f0e..de323e9c3c 100644 --- a/libavcodec/x86/rv34dsp_init.c +++ b/libavcodec/x86/rv34dsp_init.c @@ -43,5 +43,5 @@ av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, DSPContext *dsp) } if (mm_flags & AV_CPU_FLAG_SSE4) c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse4; -#endif +#endif /* HAVE_YASM */ } diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c index cf52b41416..3541ddfb70 100644 --- a/libavcodec/x86/rv40dsp_init.c +++ b/libavcodec/x86/rv40dsp_init.c @@ -234,5 +234,5 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp) QPEL_MC_SET(put_, _ssse3) QPEL_MC_SET(avg_, _ssse3) } -#endif +#endif /* HAVE_YASM */ } diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c index f7ca714481..1bf06fa3b0 100644 --- a/libavcodec/x86/vc1dsp_mmx.c +++ b/libavcodec/x86/vc1dsp_mmx.c @@ -718,8 +718,7 @@ static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq) ff_vc1_h_loop_filter8_sse4(src, stride, pq); ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq); } - -#endif +#endif /* HAVE_YASM */ void ff_put_vc1_chroma_mc8_mmx_nornd (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); @@ -822,5 +821,5 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp) dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4; dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4; } -#endif +#endif /* HAVE_YASM */ } diff --git a/libavcodec/x86/vp8dsp_init.c b/libavcodec/x86/vp8dsp_init.c index 04cfecca86..38ad0c7a08 100644 --- a/libavcodec/x86/vp8dsp_init.c +++ b/libavcodec/x86/vp8dsp_init.c @@ -289,7 +289,7 @@ DECLARE_LOOP_FILTER(sse2) DECLARE_LOOP_FILTER(ssse3) DECLARE_LOOP_FILTER(sse4) -#endif +#endif /* HAVE_YASM */ #define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \ c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \ @@ -446,5 +446,5 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse4; #endif } -#endif +#endif /* HAVE_YASM */ } diff --git a/libavresample/x86/audio_mix_init.c b/libavresample/x86/audio_mix_init.c index de4c148170..1b472afc2f 100644 --- a/libavresample/x86/audio_mix_init.c +++ b/libavresample/x86/audio_mix_init.c @@ -210,5 +210,5 @@ av_cold void ff_audio_mix_init_x86(AudioMix *am) SET_MIX_3_8_TO_1_2(6) SET_MIX_3_8_TO_1_2(7) SET_MIX_3_8_TO_1_2(8) -#endif +#endif /* HAVE_YASM */ } diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index 645bb83f77..9acc86755d 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -144,8 +144,8 @@ int ff_get_cpu_flags_x86(void) if ((eax & 0x6) == 0x6) rval |= AV_CPU_FLAG_AVX; } -#endif -#endif +#endif /* HAVE_AVX */ +#endif /* HAVE_SSE */ } cpuid(0x80000000, max_ext_level, ebx, ecx, edx); diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 9683c0cedd..db9fb732b9 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -395,7 +395,7 @@ switch(c->dstBpc){ \ if (cpu_flags & AV_CPU_FLAG_MMXEXT) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmx2, , 1); } -#endif +#endif /* ARCH_X86_32 */ #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ From cdaec0b24045963487f121a7a191dcdb530d008d Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 28 Aug 2012 14:09:35 +0200 Subject: [PATCH 10/12] avfilter: x86: Use more precise compile template names --- libavfilter/x86/yadif.c | 4 ++-- libavfilter/x86/yadif_template.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/x86/yadif.c b/libavfilter/x86/yadif.c index 750db4261e..cdf13d3e56 100644 --- a/libavfilter/x86/yadif.c +++ b/libavfilter/x86/yadif.c @@ -32,7 +32,7 @@ DECLARE_ASM_CONST(16, const xmm_reg, pb_1) = {0x0101010101010101ULL, 0x010101010 DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x0001000100010001ULL}; #if HAVE_SSSE3 -#define COMPILE_TEMPLATE_SSE 1 +#define COMPILE_TEMPLATE_SSE2 1 #define COMPILE_TEMPLATE_SSSE3 1 #undef RENAME #define RENAME(a) a ## _ssse3 @@ -44,7 +44,7 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010 #undef RENAME #define RENAME(a) a ## _sse2 #include "yadif_template.c" -#undef COMPILE_TEMPLATE_SSE +#undef COMPILE_TEMPLATE_SSE2 #endif #if HAVE_MMXEXT diff --git a/libavfilter/x86/yadif_template.c b/libavfilter/x86/yadif_template.c index 3e45f4fda0..02b0c9f909 100644 --- a/libavfilter/x86/yadif_template.c +++ b/libavfilter/x86/yadif_template.c @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifdef COMPILE_TEMPLATE_SSE +#ifdef COMPILE_TEMPLATE_SSE2 #define MM "%%xmm" #define MOV "movq" #define MOVQ "movdqa" From 50cd43f2cdb21c507e91bc26da33e24cf2e3e7ae Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 28 Aug 2012 13:56:46 +0200 Subject: [PATCH 11/12] configure: Add more fine-grained SSE CPU capabilities flags --- configure | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 5e0d76ef5b..f6a7d1f527 100755 --- a/configure +++ b/configure @@ -245,7 +245,11 @@ Optimization options (experts only): --disable-mmx disable MMX optimizations --disable-mmxext disable MMXEXT optimizations --disable-sse disable SSE optimizations + --disable-sse2 disable SSE2 optimizations + --disable-sse3 disable SSE3 optimizations --disable-ssse3 disable SSSE3 optimizations + --disable-sse4 disable SSE4 optimizations + --disable-sse42 disable SSE4.2 optimizations --disable-avx disable AVX optimizations --disable-fma4 disable FMA4 optimizations --disable-armv5te disable armv5te optimizations @@ -1061,26 +1065,34 @@ ARCH_LIST=' x86_64 ' -ARCH_EXT_LIST=' - altivec +ARCH_EXT_LIST_X86=' amd3dnow amd3dnowext + avx + fma4 + mmx + mmxext + sse + sse2 + sse3 + sse4 + sse42 + ssse3 +' + +ARCH_EXT_LIST=" + $ARCH_EXT_LIST_X86 + altivec armv5te armv6 armv6t2 armvfp - avx - fma4 mmi - mmx - mmxext neon ppc4xx - sse - ssse3 vfpv3 vis -' +" HAVE_LIST_PUB=' bigendian @@ -1325,13 +1337,18 @@ ppc4xx_deps="ppc" vis_deps="sparc" x86_64_suggest="cmov fast_cmov" + amd3dnow_deps="mmx" amd3dnowext_deps="amd3dnow" mmx_deps="x86" mmxext_deps="mmx" -sse_deps="mmx" -ssse3_deps="sse" -avx_deps="ssse3" +sse_deps="mmxext" +sse2_deps="sse" +sse3_deps="sse2" +ssse3_deps="sse3" +sse4_deps="ssse3" +sse42_deps="sse4" +avx_deps="sse42" fma4_deps="avx" aligned_stack_if_any="ppc x86" From ec36aa69448f20a78d8c4588265022e0b2272ab5 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 29 Aug 2012 11:14:17 +0200 Subject: [PATCH 12/12] x86: Fix linking with some or all of yasm, mmx, optimizations disabled Some optimized template functions reference optimized symbols, so they must be explicitly disabled when those symbols are unavailable. --- libavcodec/x86/mpegaudiodec.c | 2 ++ libavcodec/x86/mpegvideoenc.c | 34 ++++++++++++++++++++++------------ libavcodec/x86/rv40dsp_init.c | 3 +++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/libavcodec/x86/mpegaudiodec.c b/libavcodec/x86/mpegaudiodec.c index 701ae75138..d2573dd274 100644 --- a/libavcodec/x86/mpegaudiodec.c +++ b/libavcodec/x86/mpegaudiodec.c @@ -182,6 +182,7 @@ static void apply_window_mp3(float *in, float *win, int *unused, float *out, #endif /* HAVE_INLINE_ASM */ +#if HAVE_YASM #define DECL_IMDCT_BLOCKS(CPU1, CPU2) \ static void imdct36_blocks_ ## CPU1(float *out, float *buf, float *in, \ int count, int switch_point, int block_type) \ @@ -219,6 +220,7 @@ DECL_IMDCT_BLOCKS(sse2,sse) DECL_IMDCT_BLOCKS(sse3,sse) DECL_IMDCT_BLOCKS(ssse3,sse) DECL_IMDCT_BLOCKS(avx,avx) +#endif /* HAVE_YASM */ void ff_mpadsp_init_mmx(MPADSPContext *s) { diff --git a/libavcodec/x86/mpegvideoenc.c b/libavcodec/x86/mpegvideoenc.c index 946240dcd7..c3d8b835e5 100644 --- a/libavcodec/x86/mpegvideoenc.c +++ b/libavcodec/x86/mpegvideoenc.c @@ -30,13 +30,16 @@ extern uint16_t ff_inv_zigzag_direct16[64]; +#if HAVE_MMX #define COMPILE_TEMPLATE_MMXEXT 0 #define COMPILE_TEMPLATE_SSE2 0 #define COMPILE_TEMPLATE_SSSE3 0 #define RENAME(a) a ## _MMX #define RENAMEl(a) a ## _mmx #include "mpegvideoenc_template.c" +#endif /* HAVE_MMX */ +#if HAVE_MMXEXT #undef COMPILE_TEMPLATE_SSSE3 #undef COMPILE_TEMPLATE_SSE2 #undef COMPILE_TEMPLATE_MMXEXT @@ -48,7 +51,9 @@ extern uint16_t ff_inv_zigzag_direct16[64]; #define RENAME(a) a ## _MMX2 #define RENAMEl(a) a ## _mmx2 #include "mpegvideoenc_template.c" +#endif /* HAVE_MMXEXT */ +#if HAVE_SSE2 #undef COMPILE_TEMPLATE_MMXEXT #undef COMPILE_TEMPLATE_SSE2 #undef COMPILE_TEMPLATE_SSSE3 @@ -60,6 +65,7 @@ extern uint16_t ff_inv_zigzag_direct16[64]; #define RENAME(a) a ## _SSE2 #define RENAMEl(a) a ## _sse2 #include "mpegvideoenc_template.c" +#endif /* HAVE_SSE2 */ #if HAVE_SSSE3 #undef COMPILE_TEMPLATE_MMXEXT @@ -73,7 +79,7 @@ extern uint16_t ff_inv_zigzag_direct16[64]; #define RENAME(a) a ## _SSSE3 #define RENAMEl(a) a ## _sse2 #include "mpegvideoenc_template.c" -#endif +#endif /* HAVE_SSSE3 */ #endif /* HAVE_INLINE_ASM */ @@ -84,18 +90,22 @@ void ff_MPV_encode_init_x86(MpegEncContext *s) const int dct_algo = s->avctx->dct_algo; if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) { -#if HAVE_SSSE3 - if (mm_flags & AV_CPU_FLAG_SSSE3) { - s->dct_quantize = dct_quantize_SSSE3; - } else -#endif - if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { - s->dct_quantize = dct_quantize_SSE2; - } else if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) { - s->dct_quantize = dct_quantize_MMX2; - } else if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) { +#if HAVE_MMX + if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) s->dct_quantize = dct_quantize_MMX; - } +#endif +#if HAVE_MMXEXT + if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) + s->dct_quantize = dct_quantize_MMX2; +#endif +#if HAVE_SSE2 + if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) + s->dct_quantize = dct_quantize_SSE2; +#endif +#if HAVE_SSSE3 + if (mm_flags & AV_CPU_FLAG_SSSE3) + s->dct_quantize = dct_quantize_SSSE3; +#endif } #endif /* HAVE_INLINE_ASM */ } diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c index 3541ddfb70..3fccf49d0f 100644 --- a/libavcodec/x86/rv40dsp_init.c +++ b/libavcodec/x86/rv40dsp_init.c @@ -30,6 +30,7 @@ #include "libavutil/mem.h" #include "dsputil_mmx.h" +#if HAVE_YASM void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); void ff_avg_rv40_chroma_mc8_mmx2 (uint8_t *dst, uint8_t *src, @@ -183,6 +184,8 @@ QPEL_FUNCS_SET (OP, 3, 1, OPT) \ QPEL_FUNCS_SET (OP, 3, 2, OPT) /** @} */ +#endif /* HAVE_YASM */ + void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp) { #if HAVE_YASM