Re: [FFmpeg-devel] dash: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.
Jeyapal, Karthick 于2019年7月17日周三 上午10:46写道: > > > On 7/15/19 8:41 AM, leozhang wrote: > > change history: > > 1. remove unnecessary cast. > > 2. add some braces. > > > > Please comment, Thanks > Thanks for sending the patch. Please find some of my comments inlined below. Thanks for your comments. I made some changes below. Please review it, thanks. > > > > Signed-off-by: leozhang > > --- > > doc/muxers.texi | 3 +++ > > libavformat/dashenc.c | 35 --- > > 2 files changed, 35 insertions(+), 3 deletions(-) > > > > diff --git a/doc/muxers.texi b/doc/muxers.texi > > index b109297..ac06ad2 100644 > > --- a/doc/muxers.texi > > +++ b/doc/muxers.texi > > @@ -275,6 +275,9 @@ of the adaptation sets and a,b,c,d and e are the > > indices of the mapped streams. > > To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can > > be used as stream identifier instead of IDs. > > > > When no assignment is defined, this defaults to an AdaptationSet for each > > stream. > > + > > +Optional syntax is "id=x,descriptor=descriptor_str,streams=a,b,c > > id=y,streams=d,e" and so on, descriptor is useful to the scheme defined by > > ISO/IEC 23009-1:2014/Amd.2:2015. > > +And descriptor_str must be a properly formatted XML element, which is > > encoded by base64. > Two comments: > 1. Please provide an example here. So that it is easier for people to > understand For the instance using descriptor in VR tiled video application, this short interesting video https://www.hhi.fraunhofer.de/en/departments/vca/research-groups/multimedia-communications/research-topics/mpeg-omaf.html is more intuitive than a textual description. Then, how DASH pack media data in tile based streaming? Refer ISO/IEC 23009-1:2014/Amd.2:2015, for example, the descriptor string indicates that AdaptationSet is the top-left corner tile of full video divided into 2x2 tiles. Finally, how to use FFmpeg DASH muxer to generate the tile based streaming? We split the video by NxN tiles, insert descriptor syntax together with AdaptationSet in MPD. For example, the pseudo ffmpeg command {-adaptation_sets "id=0,descriptor=PFN1cHBsZW1lbnRhbFByb3BlcnR5IHNjaGVtZUlkVXJpPSJ1cm46bXBlZzpkYXNoOnNyZDoyMDE0IiB2YWx1ZT0iMCwwLDAsMSwxLDIsMiIvPg==,streams=v"} will insert descriptor string like below ... In addition to VR applications, zoomed video part can also be indicated by descriptor. > 2. Why do we need this to be base64 encoded? What is the use-case where a > normal string doesn't work? The parser code used comma and space as separator. The unencrypted descriptor string like contains comma and space, which disturbs the normal parse result. > > @item timeout @var{timeout} > > Set timeout for socket I/O operations. Applicable only for HTTP output. > > @item index_correction @var{index_correction} > > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > > index b25afb4..a48031c 100644 > > --- a/libavformat/dashenc.c > > +++ b/libavformat/dashenc.c > > @@ -34,6 +34,7 @@ > > #include "libavutil/rational.h" > > #include "libavutil/time.h" > > #include "libavutil/time_internal.h" > > +#include "libavutil/base64.h" > > > > #include "avc.h" > > #include "avformat.h" > > @@ -68,6 +69,7 @@ typedef struct Segment { > > > > typedef struct AdaptationSet { > > char id[10]; > > +char descriptor[1024]; > Please change this char * and allocate it dynamically. I understand there are > some legacy code in dashenc using this 1024 length. > But at least new code should follow dynamic allocation. Agree, will fix it > > enum AVMediaType media_type; > > AVDictionary *metadata; > > AVRational min_frame_rate, max_frame_rate; > > @@ -748,7 +750,8 @@ static int write_adaptation_set(AVFormatContext *s, > > AVIOContext *out, int as_ind > > role = av_dict_get(as->metadata, "role", NULL, 0); > > if (role) > > avio_printf(out, "\t\t\t > schemeIdUri=\"urn:mpeg:dash:role:2011\" value=\"%s\"/>\n", role->value); > > - > > +if (strlen(as->descriptor)) > > +avio_printf(out, "\t\t\t%s\n", as->descriptor); > > for (i = 0; i < s->nb_streams; i++) { > > OutputStream *os = >streams[i]; > > char bandwidth_str[64] = {'\0'}; > > @@ -820,7 +823,7 @@ static int parse_adaptation_sets(AVFormatContext *s) > > { > > DASHContext *c = s->priv_data; > > const char *p = c->adaptation_sets; > > -enum { new_set, parse_id, parsing_streams } state; > > +enum { new_set, parse_id, parsing_streams, parse_descriptor } state; > > AdaptationSet *as; > > int i, n, ret; > > > > @@ -837,6 +840,9 @@ static int parse_adaptation_sets(AVFormatContext *s) > > } > > > > // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on > > +// option id=0,descriptor=descriptor_str,streams=0,1,2 and so on > > +// descriptor is useful to the scheme defined by ISO/IEC > > 23009-1:2014/Amd.2:2015 > > +// descriptor_str must be a properly
Re: [FFmpeg-devel] [PATCH] avformat/mpegenc - reject unsupported audio streams
On 08-07-2019 05:35 PM, Gyan wrote: On 25-04-2019 01:48 PM, Gyan wrote: On 25-04-2019 01:23 PM, Ali KIZIL wrote: There are also Dolby Codecs (ac3 & eac3). Will it also throw error for these codecs ? AC3 is supported before and after this patch. EAC3 is unsupported before and after this patch. But it's sent to the same decoder, so support could be added. I'll check. Attached patch allows muxing EAC3 in MPEG-PS. Stock ffmpeg can demux and decode such streams fine. Will push tonight. Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] matroskadec: Add sizes to forward declarations
Unknown-length elements end when an element not allowed in them, but allowed at a higher level is encountered. In order to check for this, c1abd95a added a pointer to every syntax level's parent to each EbmlSyntax. Given that the parent must of course also reference the child in order to be able to enter said child level, one needs to use forward declarations. These forward declarations constitute tentative definitions and tentative definitions with internal linkage (like our syntaxes) must not be an incomplete type. Yet they were an incomplete type and while GCC and Clang did not even warn about this (on default warning levels), it broke compilation with MSVC. Therefore this commit adds the sizes. Signed-off-by: Andreas Rheinhardt --- 1. I am terribly sorry for this. I did test with both GCC and Clang, but not with -pedantic, but only with default warning levels. 2. I don't have an MSVC setup here, so could please someone confirm that this patch indeed fixes the compilation? All I know is that GCC's -pedantic warnings are gone with this patch and that the requirement that tentative definitions with internal linkage must not be of incomplete type is fulfilled now. libavformat/matroskadec.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index b97189e674..fb0356e7b7 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -389,12 +389,16 @@ typedef struct MatroskaDemuxContext { #define CHILD_OF(parent) { .def = { .n = parent } } -static const EbmlSyntax ebml_syntax[], matroska_segment[], matroska_track_video_color[], matroska_track_video[], -matroska_track[], matroska_track_encoding[], matroska_track_encodings[], -matroska_track_combine_planes[], matroska_track_operation[], matroska_tracks[], -matroska_attachments[], matroska_chapter_entry[], matroska_chapter[], matroska_chapters[], -matroska_index_entry[], matroska_index[], matroska_tag[], matroska_tags[], matroska_seekhead[], -matroska_blockadditions[], matroska_blockgroup[], matroska_cluster_parsing[]; +// The following forward declarations need their size because +// a tentative definition with internal linkage must not be an +// incomplete type (6.7.2 in C90, 6.9.2 in C99). +// Removing the sizes breaks MSVC. +static const EbmlSyntax ebml_syntax[3], matroska_segment[9], matroska_track_video_color[15], matroska_track_video[19], +matroska_track[27], matroska_track_encoding[6], matroska_track_encodings[2], +matroska_track_combine_planes[2], matroska_track_operation[2], matroska_tracks[2], +matroska_attachments[2], matroska_chapter_entry[9], matroska_chapter[6], matroska_chapters[2], +matroska_index_entry[3], matroska_index[2], matroska_tag[3], matroska_tags[2], matroska_seekhead[2], +matroska_blockadditions[2], matroska_blockgroup[8], matroska_cluster_parsing[8]; static const EbmlSyntax ebml_header[] = { { EBML_ID_EBMLREADVERSION,EBML_UINT, 0, offsetof(Ebml, version), { .u = EBML_VERSION } }, -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] dash: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.
On 7/15/19 8:41 AM, leozhang wrote: > change history: > 1. remove unnecessary cast. > 2. add some braces. > > Please comment, Thanks Thanks for sending the patch. Please find some of my comments inlined below. > > Signed-off-by: leozhang > --- > doc/muxers.texi | 3 +++ > libavformat/dashenc.c | 35 --- > 2 files changed, 35 insertions(+), 3 deletions(-) > > diff --git a/doc/muxers.texi b/doc/muxers.texi > index b109297..ac06ad2 100644 > --- a/doc/muxers.texi > +++ b/doc/muxers.texi > @@ -275,6 +275,9 @@ of the adaptation sets and a,b,c,d and e are the indices > of the mapped streams. > To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be > used as stream identifier instead of IDs. > > When no assignment is defined, this defaults to an AdaptationSet for each > stream. > + > +Optional syntax is "id=x,descriptor=descriptor_str,streams=a,b,c > id=y,streams=d,e" and so on, descriptor is useful to the scheme defined by > ISO/IEC 23009-1:2014/Amd.2:2015. > +And descriptor_str must be a properly formatted XML element, which is > encoded by base64. Two comments: 1. Please provide an example here. So that it is easier for people to understand 2. Why do we need this to be base64 encoded? What is the use-case where a normal string doesn't work? > @item timeout @var{timeout} > Set timeout for socket I/O operations. Applicable only for HTTP output. > @item index_correction @var{index_correction} > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > index b25afb4..a48031c 100644 > --- a/libavformat/dashenc.c > +++ b/libavformat/dashenc.c > @@ -34,6 +34,7 @@ > #include "libavutil/rational.h" > #include "libavutil/time.h" > #include "libavutil/time_internal.h" > +#include "libavutil/base64.h" > > #include "avc.h" > #include "avformat.h" > @@ -68,6 +69,7 @@ typedef struct Segment { > > typedef struct AdaptationSet { > char id[10]; > +char descriptor[1024]; Please change this char * and allocate it dynamically. I understand there are some legacy code in dashenc using this 1024 length. But at least new code should follow dynamic allocation. > enum AVMediaType media_type; > AVDictionary *metadata; > AVRational min_frame_rate, max_frame_rate; > @@ -748,7 +750,8 @@ static int write_adaptation_set(AVFormatContext *s, > AVIOContext *out, int as_ind > role = av_dict_get(as->metadata, "role", NULL, 0); > if (role) > avio_printf(out, "\t\t\t schemeIdUri=\"urn:mpeg:dash:role:2011\" value=\"%s\"/>\n", role->value); > - > +if (strlen(as->descriptor)) > +avio_printf(out, "\t\t\t%s\n", as->descriptor); > for (i = 0; i < s->nb_streams; i++) { > OutputStream *os = >streams[i]; > char bandwidth_str[64] = {'\0'}; > @@ -820,7 +823,7 @@ static int parse_adaptation_sets(AVFormatContext *s) > { > DASHContext *c = s->priv_data; > const char *p = c->adaptation_sets; > -enum { new_set, parse_id, parsing_streams } state; > +enum { new_set, parse_id, parsing_streams, parse_descriptor } state; > AdaptationSet *as; > int i, n, ret; > > @@ -837,6 +840,9 @@ static int parse_adaptation_sets(AVFormatContext *s) > } > > // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on > +// option id=0,descriptor=descriptor_str,streams=0,1,2 and so on > +// descriptor is useful to the scheme defined by ISO/IEC > 23009-1:2014/Amd.2:2015 > +// descriptor_str must be a properly formatted XML element, encoded by > base64. > state = new_set; > while (*p) { > if (*p == ' ') { > @@ -854,7 +860,30 @@ static int parse_adaptation_sets(AVFormatContext *s) > if (*p) > p++; > state = parse_id; > -} else if (state == parse_id && av_strstart(p, "streams=", )) { > +} else if (state == parse_id && av_strstart(p, "descriptor=", )) { > +char *encode_str, *decode_str; > +int decode_size, ret; > + > +n = strcspn(p, ","); > +encode_str = av_strndup(p, n); > +decode_size = AV_BASE64_DECODE_SIZE(n); > +decode_str = av_mallocz(decode_size); > +if (decode_str) { > +ret = av_base64_decode(decode_str, encode_str, decode_size); > +if (ret >= 0) > +snprintf(as->descriptor, sizeof(as->descriptor), "%.*s", > decode_size, decode_str); > +else > +av_log(s, AV_LOG_WARNING, "descriptor string is invalid > base64 encode\n"); > +} else { > +av_log(s, AV_LOG_WARNING, "av_mallocz failed, will not parse > descriptor\n"); > +} > +p += n; > +if (*p) > +p++; > +state = parse_descriptor; > +av_freep(_str); > +av_freep(_str); > +} else if ((state == parse_id || state == parse_descriptor) && > av_strstart(p,
Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc
On Tue, Jul 16, 2019 at 09:36:32PM -0400, Rick Kern wrote: > On Wed, Jul 10, 2019 at 5:29 AM Dennis Mungai wrote: > > > On Wed, Jul 10, 2019, 11:06 Hendrik Leppkes wrote: > > > > > On Wed, Jul 10, 2019 at 4:23 AM Dennis Mungai wrote: > > > > > > > > On Wed, Jul 10, 2019, 03:05 Aman Gupta wrote: > > > > > > > > > On Wed, Jun 26, 2019 at 4:25 AM wrote: > > > > > > > > > > > From: Limin Wang > > > > > > > > > > > > Below is the testing ffmpeg command for the setting: > > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 > > > > > > -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts > > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 > > > > > > -colorspace bt2020_ncl -color_trc linear linear.ts > > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 > > > > > > -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts > > > > > > > > > > > > > > > > Patch looks reasonable to me. Will commit in a few days if no one > > else > > > > > comments. > > > > > > > > > > Aman > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Limin Wang > > > > > > --- > > > > > > configure| 6 ++ > > > > > > libavcodec/videotoolboxenc.c | 16 > > > > > > 2 files changed, 22 insertions(+) > > > > > > > > > > > > diff --git a/configure b/configure > > > > > > index 7cea9d4d73..0a5e940c0c 100755 > > > > > > --- a/configure > > > > > > +++ b/configure > > > > > > @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES=" > > > > > > TYPES_LIST=" > > > > > > kCMVideoCodecType_HEVC > > > > > > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange > > > > > > +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ > > > > > > +kCVImageBufferTransferFunction_ITU_R_2100_HLG > > > > > > +kCVImageBufferTransferFunction_Linear > > > > > > socklen_t > > > > > > struct_addrinfo > > > > > > struct_group_source_req > > > > > > @@ -6044,6 +6047,9 @@ enabled videotoolbox && { > > > > > > check_lib coreservices CoreServices/CoreServices.h > > > > > > UTGetOSTypeFromString "-framework CoreServices" > > > > > > check_func_headers CoreMedia/CMFormatDescription.h > > > > > > kCMVideoCodecType_HEVC "-framework CoreMedia" > > > > > > check_func_headers CoreVideo/CVPixelBuffer.h > > > > > > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework > > > CoreVideo" > > > > > > +check_func_headers CoreVideo/CVImageBuffer.h > > > > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework > > > CoreVideo" > > > > > > +check_func_headers CoreVideo/CVImageBuffer.h > > > > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework > > CoreVideo" > > > > > > +check_func_headers CoreVideo/CVImageBuffer.h > > > > > > kCVImageBufferTransferFunction_Linear "-framework CoreVideo" > > > > > > } > > > > > > > > > > > > check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss > > > > > > diff --git a/libavcodec/videotoolboxenc.c > > > b/libavcodec/videotoolboxenc.c > > > > > > index f8ccdea52d..0dc6eb4cf4 100644 > > > > > > --- a/libavcodec/videotoolboxenc.c > > > > > > +++ b/libavcodec/videotoolboxenc.c > > > > > > @@ -915,6 +915,22 @@ static int > > > get_cv_transfer_function(AVCodecContext > > > > > > *avctx, > > > > > > *transfer_fnc = > > > > > > kCVImageBufferTransferFunction_SMPTE_240M_1995; > > > > > > break; > > > > > > > > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ > > > > > > +case AVCOL_TRC_SMPTE2084: > > > > > > +*transfer_fnc = > > > > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ; > > > > > > +break; > > > > > > +#endif > > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR > > > > > > +case AVCOL_TRC_LINEAR: > > > > > > +*transfer_fnc = kCVImageBufferTransferFunction_Linear; > > > > > > +break; > > > > > > +#endif > > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG > > > > > > +case AVCOL_TRC_ARIB_STD_B67: > > > > > > +*transfer_fnc = > > > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG; > > > > > > +break; > > > > > > +#endif > > > > > > + > > > > > > case AVCOL_TRC_GAMMA22: > > > > > > gamma = 2.2; > > > > > > *transfer_fnc = > > kCVImageBufferTransferFunction_UseGamma; > > > > > > -- > > > > > > 2.21.0 > > > > > > > > > > > > ___ > > > > > > ffmpeg-devel mailing list > > > > > > ffmpeg-devel@ffmpeg.org > > > > > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > > > > > > > > > To unsubscribe, visit link above, or email > > > > > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > > > > > > > > > > > > A while back, a similar patch was rejected for NVENC (from the same > > > author) > > > > on the basis of such functionality not being suitably placed as an > > > encoder > > > > feature.
Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc
On Wed, Jul 10, 2019 at 5:29 AM Dennis Mungai wrote: > On Wed, Jul 10, 2019, 11:06 Hendrik Leppkes wrote: > > > On Wed, Jul 10, 2019 at 4:23 AM Dennis Mungai wrote: > > > > > > On Wed, Jul 10, 2019, 03:05 Aman Gupta wrote: > > > > > > > On Wed, Jun 26, 2019 at 4:25 AM wrote: > > > > > > > > > From: Limin Wang > > > > > > > > > > Below is the testing ffmpeg command for the setting: > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 > > > > > -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 > > > > > -colorspace bt2020_ncl -color_trc linear linear.ts > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 > > > > > -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts > > > > > > > > > > > > > Patch looks reasonable to me. Will commit in a few days if no one > else > > > > comments. > > > > > > > > Aman > > > > > > > > > > > > > > > > > > Signed-off-by: Limin Wang > > > > > --- > > > > > configure| 6 ++ > > > > > libavcodec/videotoolboxenc.c | 16 > > > > > 2 files changed, 22 insertions(+) > > > > > > > > > > diff --git a/configure b/configure > > > > > index 7cea9d4d73..0a5e940c0c 100755 > > > > > --- a/configure > > > > > +++ b/configure > > > > > @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES=" > > > > > TYPES_LIST=" > > > > > kCMVideoCodecType_HEVC > > > > > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange > > > > > +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ > > > > > +kCVImageBufferTransferFunction_ITU_R_2100_HLG > > > > > +kCVImageBufferTransferFunction_Linear > > > > > socklen_t > > > > > struct_addrinfo > > > > > struct_group_source_req > > > > > @@ -6044,6 +6047,9 @@ enabled videotoolbox && { > > > > > check_lib coreservices CoreServices/CoreServices.h > > > > > UTGetOSTypeFromString "-framework CoreServices" > > > > > check_func_headers CoreMedia/CMFormatDescription.h > > > > > kCMVideoCodecType_HEVC "-framework CoreMedia" > > > > > check_func_headers CoreVideo/CVPixelBuffer.h > > > > > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework > > CoreVideo" > > > > > +check_func_headers CoreVideo/CVImageBuffer.h > > > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework > > CoreVideo" > > > > > +check_func_headers CoreVideo/CVImageBuffer.h > > > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework > CoreVideo" > > > > > +check_func_headers CoreVideo/CVImageBuffer.h > > > > > kCVImageBufferTransferFunction_Linear "-framework CoreVideo" > > > > > } > > > > > > > > > > check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss > > > > > diff --git a/libavcodec/videotoolboxenc.c > > b/libavcodec/videotoolboxenc.c > > > > > index f8ccdea52d..0dc6eb4cf4 100644 > > > > > --- a/libavcodec/videotoolboxenc.c > > > > > +++ b/libavcodec/videotoolboxenc.c > > > > > @@ -915,6 +915,22 @@ static int > > get_cv_transfer_function(AVCodecContext > > > > > *avctx, > > > > > *transfer_fnc = > > > > > kCVImageBufferTransferFunction_SMPTE_240M_1995; > > > > > break; > > > > > > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ > > > > > +case AVCOL_TRC_SMPTE2084: > > > > > +*transfer_fnc = > > > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ; > > > > > +break; > > > > > +#endif > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR > > > > > +case AVCOL_TRC_LINEAR: > > > > > +*transfer_fnc = kCVImageBufferTransferFunction_Linear; > > > > > +break; > > > > > +#endif > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG > > > > > +case AVCOL_TRC_ARIB_STD_B67: > > > > > +*transfer_fnc = > > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG; > > > > > +break; > > > > > +#endif > > > > > + > > > > > case AVCOL_TRC_GAMMA22: > > > > > gamma = 2.2; > > > > > *transfer_fnc = > kCVImageBufferTransferFunction_UseGamma; > > > > > -- > > > > > 2.21.0 > > > > > > > > > > ___ > > > > > ffmpeg-devel mailing list > > > > > ffmpeg-devel@ffmpeg.org > > > > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > > > > > > > To unsubscribe, visit link above, or email > > > > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > > > > > > > > > A while back, a similar patch was rejected for NVENC (from the same > > author) > > > on the basis of such functionality not being suitably placed as an > > encoder > > > feature. > > > > > > Looking back at other implementations, eg hevc_vaapi, the same is > indeed > > > allowed, where SEI metadata retention for HDR is present. > > > > > > To the OP: If the patch for NVENC were refactored in a manner similar > to > > > this, abstracting details such as master display info
[FFmpeg-devel] FFmpeg classification
Hello Hope all is well. Currently I am researching about the trends of FFmpeg and its supporting codecs, and in order to do so I am trying to classify FFmpeg codecs into different types. Are there meaningful categories to classify these codes other than video/audio or lossy/lossless? Many thanks, Maaya -- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Any views or opinions expressed in this email are solely those of the author and do not necessarily represent those of PwC. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] lavf/f_select: support scenecut with more pixel formats
On Wed, Jul 17, 2019 at 12:58:04AM +0200, Marton Balint wrote: > > > On Tue, 16 Jul 2019, lance.lmw...@gmail.com wrote: > > >From: Limin Wang > > > >This patch haven't make other pixel format usable yet to make sure the test > >result is same with rgb format. > > > >Signed-off-by: Limin Wang > >--- > >libavfilter/f_select.c | 34 ++ > >1 file changed, 30 insertions(+), 4 deletions(-) > > > >diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c > >index 1132375..eed8df3 100644 > >--- a/libavfilter/f_select.c > >+++ b/libavfilter/f_select.c > >@@ -28,6 +28,8 @@ > >#include "libavutil/fifo.h" > >#include "libavutil/internal.h" > >#include "libavutil/opt.h" > >+#include "libavutil/imgutils.h" > >+#include "libavutil/pixdesc.h" > >#include "avfilter.h" > >#include "audio.h" > >#include "formats.h" > >@@ -144,6 +146,10 @@ typedef struct SelectContext { > >char *expr_str; > >AVExpr *expr; > >double var_values[VAR_VARS_NB]; > >+int bitdepth; > >+int nb_planes; > >+ptrdiff_t width[4]; > >+ptrdiff_t height[4]; > >int do_scene_detect;///< 1 if the expression requires scene > > detection variables, 0 otherwise > >ff_scene_sad_fn sad;///< Sum of the absolute difference > > function (scene detect only) > >double prev_mafd; ///< previous MAFD > > (scene detect only) > >@@ -202,6 +208,17 @@ static av_cold int init(AVFilterContext *ctx) > >static int config_input(AVFilterLink *inlink) > >{ > >SelectContext *select = inlink->dst->priv; > >+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); > >+ > >+select->bitdepth = desc->comp[0].depth; > >+select->nb_planes = av_pix_fmt_count_planes(inlink->format); > >+for (int plane = 0; plane < select->nb_planes; plane++) { > >+ptrdiff_t line_size = av_image_get_linesize(inlink->format, > >inlink->w, plane); > >+int vsub = desc->log2_chroma_h; > >+ > >+select->width[plane] = line_size >> (select->bitdepth > 8); > >+select->height[plane] = plane == 1 || plane == 2 ? > >AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h; > >+} > > > >select->var_values[VAR_N] = 0.0; > >select->var_values[VAR_SELECTED_N] = 0.0; > >@@ -242,7 +259,7 @@ static int config_input(AVFilterLink *inlink) > >inlink->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN; > > > >if (CONFIG_SELECT_FILTER && select->do_scene_detect) { > >-select->sad = ff_scene_sad_get_fn(8); > >+select->sad = ff_scene_sad_get_fn(select->bitdepth == 8 ? 8 : 16); > >if (!select->sad) > >return AVERROR(EINVAL); > >} > >@@ -258,12 +275,21 @@ static double get_scene_score(AVFilterContext *ctx, > >AVFrame *frame) > >if (prev_picref && > >frame->height == prev_picref->height && > >frame->width == prev_picref->width) { > >-uint64_t sad; > >+uint64_t sad = 0; > >double mafd, diff; > >+int count = 0; > >+ > >+for (int plane = 0; plane < select->nb_planes; plane++) { > >+uint64_t plane_sad; > >+select->sad(prev_picref->data[plane], > >prev_picref->linesize[plane], > >+frame->data[plane], frame->linesize[plane], > >+select->width[plane], select->height[plane], > >_sad); > >+sad += plane_sad; > >+count += select->width[plane] * select->height[plane]; > >+} > > > >-select->sad(prev_picref->data[0], prev_picref->linesize[0], > >frame->data[0], frame->linesize[0], frame->width * 3, frame->height, ); > >emms_c(); > >-mafd = (double)sad / (frame->width * 3 * frame->height); > >+mafd = (double)sad / count; > > mafd was in [0..255] before you added >8 bitdepth support. For >8 > bit you have to normalize it to this range becuase the metric should > be bitdepth invariant. Yes, I think 100 should be change to 1ULL << bitdepth. However if change it, it'll make the threshold is very different with old way. So I haven't clear how to touched it to keep constant with the old. I'll try get one HDR 10bit sample to test the 10bit, I guess my current 10bit sample isn't real 10bit. > > Regards, > Marton > > >diff = fabs(mafd - select->prev_mafd); > >ret = av_clipf(FFMIN(mafd, diff) / 100., 0, 1); > >select->prev_mafd = mafd; > >-- > >2.6.4 > > > >___ > >ffmpeg-devel mailing list > >ffmpeg-devel@ffmpeg.org > >https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > >To unsubscribe, visit link above, or email > >ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject
Re: [FFmpeg-devel] [PATCH 3/3] lavf/f_select: make the more pixel format usable to avoid autoscale to rgb
On Tue, 16 Jul 2019, lance.lmw...@gmail.com wrote: From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/f_select.c | 6 ++ tests/ref/fate/filter-metadata-scenedetect | 16 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index eed8df3..35aed3f 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -499,6 +499,12 @@ static int query_formats(AVFilterContext *ctx) int ret; static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, +AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA, +AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, +AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, +AV_PIX_FMT_YUYV422, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, +AV_PIX_FMT_NV12, AV_PIX_FMT_NV21, AV_PIX_FMT_P010, +AV_PIX_FMT_P016, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_P010 is tricky, because in this format data is in the high bits. So scores should be normalized as if it would be 16 bit. Regards, Marton AV_PIX_FMT_NONE }; AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); diff --git a/tests/ref/fate/filter-metadata-scenedetect b/tests/ref/fate/filter-metadata-scenedetect index 67c23b3..7ce2d67 100644 --- a/tests/ref/fate/filter-metadata-scenedetect +++ b/tests/ref/fate/filter-metadata-scenedetect @@ -1,11 +1,11 @@ pkt_pts=1620|tag:lavfi.scene_score=1.00 -pkt_pts=4140|tag:lavfi.scene_score=0.875036 -pkt_pts=5800|tag:lavfi.scene_score=1.00 -pkt_pts=6720|tag:lavfi.scene_score=0.461625 -pkt_pts=8160|tag:lavfi.scene_score=1.00 -pkt_pts=9760|tag:lavfi.scene_score=1.00 -pkt_pts=14080|tag:lavfi.scene_score=0.838916 +pkt_pts=4140|tag:lavfi.scene_score=0.668643 +pkt_pts=5800|tag:lavfi.scene_score=0.996721 +pkt_pts=6720|tag:lavfi.scene_score=0.357390 +pkt_pts=8160|tag:lavfi.scene_score=0.886268 +pkt_pts=9760|tag:lavfi.scene_score=0.926219 +pkt_pts=14080|tag:lavfi.scene_score=0.650033 pkt_pts=15700|tag:lavfi.scene_score=1.00 -pkt_pts=18500|tag:lavfi.scene_score=0.474948 -pkt_pts=20040|tag:lavfi.scene_score=0.379700 +pkt_pts=18500|tag:lavfi.scene_score=0.316402 +pkt_pts=20040|tag:lavfi.scene_score=0.269509 pkt_pts=21760|tag:lavfi.scene_score=1.00 -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] lavf/f_select: support scenecut with more pixel formats
On Tue, 16 Jul 2019, lance.lmw...@gmail.com wrote: From: Limin Wang This patch haven't make other pixel format usable yet to make sure the test result is same with rgb format. Signed-off-by: Limin Wang --- libavfilter/f_select.c | 34 ++ 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 1132375..eed8df3 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -28,6 +28,8 @@ #include "libavutil/fifo.h" #include "libavutil/internal.h" #include "libavutil/opt.h" +#include "libavutil/imgutils.h" +#include "libavutil/pixdesc.h" #include "avfilter.h" #include "audio.h" #include "formats.h" @@ -144,6 +146,10 @@ typedef struct SelectContext { char *expr_str; AVExpr *expr; double var_values[VAR_VARS_NB]; +int bitdepth; +int nb_planes; +ptrdiff_t width[4]; +ptrdiff_t height[4]; int do_scene_detect;///< 1 if the expression requires scene detection variables, 0 otherwise ff_scene_sad_fn sad;///< Sum of the absolute difference function (scene detect only) double prev_mafd; ///< previous MAFD (scene detect only) @@ -202,6 +208,17 @@ static av_cold int init(AVFilterContext *ctx) static int config_input(AVFilterLink *inlink) { SelectContext *select = inlink->dst->priv; +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); + +select->bitdepth = desc->comp[0].depth; +select->nb_planes = av_pix_fmt_count_planes(inlink->format); +for (int plane = 0; plane < select->nb_planes; plane++) { +ptrdiff_t line_size = av_image_get_linesize(inlink->format, inlink->w, plane); +int vsub = desc->log2_chroma_h; + +select->width[plane] = line_size >> (select->bitdepth > 8); +select->height[plane] = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h; +} select->var_values[VAR_N] = 0.0; select->var_values[VAR_SELECTED_N] = 0.0; @@ -242,7 +259,7 @@ static int config_input(AVFilterLink *inlink) inlink->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN; if (CONFIG_SELECT_FILTER && select->do_scene_detect) { -select->sad = ff_scene_sad_get_fn(8); +select->sad = ff_scene_sad_get_fn(select->bitdepth == 8 ? 8 : 16); if (!select->sad) return AVERROR(EINVAL); } @@ -258,12 +275,21 @@ static double get_scene_score(AVFilterContext *ctx, AVFrame *frame) if (prev_picref && frame->height == prev_picref->height && frame->width == prev_picref->width) { -uint64_t sad; +uint64_t sad = 0; double mafd, diff; +int count = 0; + +for (int plane = 0; plane < select->nb_planes; plane++) { +uint64_t plane_sad; +select->sad(prev_picref->data[plane], prev_picref->linesize[plane], +frame->data[plane], frame->linesize[plane], +select->width[plane], select->height[plane], _sad); +sad += plane_sad; +count += select->width[plane] * select->height[plane]; +} -select->sad(prev_picref->data[0], prev_picref->linesize[0], frame->data[0], frame->linesize[0], frame->width * 3, frame->height, ); emms_c(); -mafd = (double)sad / (frame->width * 3 * frame->height); +mafd = (double)sad / count; mafd was in [0..255] before you added >8 bitdepth support. For >8 bit you have to normalize it to this range becuase the metric should be bitdepth invariant. Regards, Marton diff = fabs(mafd - select->prev_mafd); ret = av_clipf(FFMIN(mafd, diff) / 100., 0, 1); select->prev_mafd = mafd; -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/decode: Fix missing PTS/DTS for decoders like wmapro
On Sun, Jul 14, 2019 at 06:40:35PM -0400, fumoboy...@me.com wrote: > From: fumoboy007 > > Added back comment (deleted in 061a0c14bb5767bca72e3a7227ca400de439ba09) > explaining that some audio decoders like wmapro may consume partial data > without returning a frame. > > For these cases, `decode_simple_internal` will be called several times before > the frame is complete. Due to a bug that this commit fixes, the PTS/DTS that > was set on the first call would be reset to AV_NOPTS_VALUE on the subsequent > calls. > --- > libavcodec/decode.c | 23 ++- > 1 file changed, 18 insertions(+), 5 deletions(-) this breaks fate-flcl1905 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In fact, the RIAA has been known to suggest that students drop out of college or go to community college in order to be able to afford settlements. -- The RIAA signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/sanm: Check extradata_size before allocations
On Tue, Jul 16, 2019 at 08:27:43AM +0200, Reimar Döffinger wrote: > On 16.07.2019, at 00:50, Michael Niedermayer wrote: > > > Fixes: Leaks > > Fixes: > > 15349/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5102530557640704 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/sanm.c | 9 - > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c > > index 25aee7220f..60e2f4c624 100644 > > --- a/libavcodec/sanm.c > > +++ b/libavcodec/sanm.c > > @@ -491,6 +491,10 @@ static av_cold int decode_init(AVCodecContext *avctx) > > > > ctx->avctx = avctx; > > ctx->version = !avctx->extradata_size; > > +if (!ctx->version && avctx->extradata_size < 1026) { > > +av_log(avctx, AV_LOG_ERROR, "Not enough extradata.\n"); > > +return AVERROR_INVALIDDATA; > > +} > > > > avctx->pix_fmt = ctx->version ? AV_PIX_FMT_RGB565 : AV_PIX_FMT_PAL8; > > > > @@ -506,11 +510,6 @@ static av_cold int decode_init(AVCodecContext *avctx) > > if (!ctx->version) { > > int i; > > > > -if (avctx->extradata_size < 1026) { > > -av_log(avctx, AV_LOG_ERROR, "Not enough extradata.\n"); > > -return AVERROR_INVALIDDATA; > > -} > > This seems quite a bit less obvious. > Is that the only error return case, and is adding the cleanup code complex > enough that this is the better choice? there are 2 error cases, this one and a check for the allocations. It seemd logic to me to do the check in the order of minimizing cleanup but i can add the cleanup call if people prefer or do some other solution ? > Either way I'd recommend a comment like > // early sanity check before allocations to avoid need for deallocation code. will add thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/fitsdec: Prevent division by 0 with huge data_max
On Tue, Jul 16, 2019 at 08:34:14AM +0200, Reimar Döffinger wrote: > On 16.07.2019, at 00:50, Michael Niedermayer wrote: > > > Fixes: division by 0 > > Fixes: > > 15657/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5738154838982656 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/fitsdec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c > > index 4f452422ef..fe941f199d 100644 > > --- a/libavcodec/fitsdec.c > > +++ b/libavcodec/fitsdec.c > > @@ -174,7 +174,7 @@ static int fits_read_header(AVCodecContext *avctx, > > const uint8_t **ptr, FITSHead > > return AVERROR_INVALIDDATA; > > } > > av_log(avctx, AV_LOG_WARNING, "data min/max indicates a blank > > image\n"); > > -header->data_max ++; > > +header->data_max += fabs(header->data_max) / 1000 + 1; > > This is really non-obvious, both by itself, in where/how it causes the > division by 0 and that the error here isn't worse than the division by 0 for > example, and why this constant was chosen. division by 0 occured in: *dst++ = ((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) / (header.data_max - header.data_min); \ > Also why a division and not a multiply by the inverse? no reason, this could be changed > Why not * (1.0f / (1 << 24)) for example, which for single-precision IEEE I > think should result in exactly 1 ULP (well, possibly 2 with rounding) > increments? the division by 0 could occur with files which contain only one color. Or otherwise corrupted / odd files. what the code tries to do is to do a reasonable small change away from division by 0. The way the whole implementation of fits is done is to scale the input range to the output range. If the input is 0 as it can be on a constant color input this hits a singularity. As this is basically a 0/0 anything could be output and would be equally wrong so the exact value like / 1000 or other dont really matter. For these values to matter, first how the decoder interprets data would have to be changed: " Also to interpret data, values are linearly scaled using min-max scaling but not RGB images." > Why is this even using floating-point? And why not double-precision at least? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] libavcodec/amfenc: Vulkan initialization support for encoder.
Added linux support for amf encoder through vulkan. To use h.264(AMD VCE) encoder on linux amdgru-pro version 19.20+ and amf-amdgpu-pro package(amdgru-pro contains, but does not install automatically) are required. This driver can be installed using amdgpu-pro-install script in official amd driver archive. Initialization of amf encoder occurs in this order: 1) trying to initialize through dx11(only windows) 2) trying to initialize through dx9(only windows) 3) trying to initialize through vulkan Only Vulkan initialization available on linux. --- doc/general.texi| 16 +--- libavcodec/amfenc.c | 17 +++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/doc/general.texi b/doc/general.texi index 3c0c803449..056f88fba3 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -27,16 +27,26 @@ enable it. @section AMD AMF/VCE -FFmpeg can use the AMD Advanced Media Framework library under Windows -for accelerated H.264 and HEVC encoding on hardware with Video Coding Engine (VCE). +FFmpeg can use the AMD Advanced Media Framework library +for accelerated H.264 and HEVC(only windows) encoding on hardware with Video Coding Engine (VCE). -To enable support you must obtain the AMF framework header files from +To enable support you must obtain the AMF framework header files(version 1.4.9+) from @url{https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git}. Create an @code{AMF/} directory in the system include path. Copy the contents of @code{AMF/amf/public/include/} into that directory. Then configure FFmpeg with @code{--enable-amf}. +Initialization of amf encoder occurs in this order: +1) trying to initialize through dx11(only windows) +2) trying to initialize through dx9(only windows) +3) trying to initialize through vulkan + +To use h.264(AMD VCE) encoder on linux amdgru-pro version 19.20+ and amf-amdgpu-pro +package(amdgru-pro contains, but does not install automatically) are required. + +This driver can be installed using amdgpu-pro-install script in official amd driver archive. + @section AviSynth FFmpeg can read AviSynth scripts as input. To enable support, pass diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index 384d8efc92..f66b95645e 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -213,6 +213,7 @@ static int amf_init_from_dxva2_device(AVCodecContext *avctx, AVDXVA2DeviceContex static int amf_init_context(AVCodecContext *avctx) { AmfContext *ctx = avctx->priv_data; +AMFContext1 *context1 = NULL; AMF_RESULT res; av_unused int ret; @@ -311,8 +312,20 @@ static int amf_init_context(AVCodecContext *avctx) if (res == AMF_OK) { av_log(avctx, AV_LOG_VERBOSE, "AMF initialisation succeeded via D3D9.\n"); } else { -av_log(avctx, AV_LOG_ERROR, "AMF initialisation failed via D3D9: error %d.\n", res); -return AVERROR(ENOSYS); +AMFGuid guid = IID_AMFContext1(); +res = ctx->context->pVtbl->QueryInterface(ctx->context, , (void**)); +AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, "CreateContext1() failed with error %d\n", res); + +res = context1->pVtbl->InitVulkan(context1, NULL); +context1->pVtbl->Release(context1); +if (res != AMF_OK) { +if (res == AMF_NOT_SUPPORTED) +av_log(avctx, AV_LOG_ERROR, "AMF via Vulkan is not supported on the given device.\n"); +else +av_log(avctx, AV_LOG_ERROR, "AMF failed to initialise on the given Vulkan device: %d.\n", res); +return AVERROR(ENOSYS); +} +av_log(avctx, AV_LOG_VERBOSE, "AMF initialisation succeeded via Vulkan.\n"); } } } -- 2.19.1.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
Signed-off-by: Paul B Mahol --- configure | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h| 1 + libavcodec/codec_desc.c | 7 ++ libavcodec/imm5.c | 188 libavformat/riff.c | 1 + 7 files changed, 200 insertions(+) create mode 100644 libavcodec/imm5.c diff --git a/configure b/configure index 5a4f507246..d03cf43350 100755 --- a/configure +++ b/configure @@ -2714,6 +2714,7 @@ huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" hymt_decoder_select="huffyuv_decoder" iac_decoder_select="imc_decoder" imc_decoder_select="bswapdsp fft mdct sinewin" +imm5_decoder_select="h264_decoder hevc_decoder" indeo3_decoder_select="hpeldsp" indeo4_decoder_select="ividsp" indeo5_decoder_select="ividsp" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3cd73fbcc6..39f4d9118c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -393,6 +393,7 @@ OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o OBJS-$(CONFIG_IMC_DECODER) += imc.o OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o +OBJS-$(CONFIG_IMM5_DECODER)+= imm5.o OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39ce5..fe7f773925 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -158,6 +158,7 @@ extern AVCodec ff_hymt_decoder; extern AVCodec ff_idcin_decoder; extern AVCodec ff_iff_ilbm_decoder; extern AVCodec ff_imm4_decoder; +extern AVCodec ff_imm5_decoder; extern AVCodec ff_indeo2_decoder; extern AVCodec ff_indeo3_decoder; extern AVCodec ff_indeo4_decoder; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 2528bd89ab..da6f92b443 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -457,6 +457,7 @@ enum AVCodecID { AV_CODEC_ID_AGM, AV_CODEC_ID_LSCR, AV_CODEC_ID_VP4, +AV_CODEC_ID_IMM5, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 4d033c20ff..e6373be504 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), .props = AV_CODEC_PROP_LOSSY, }, +{ +.id= AV_CODEC_ID_IMM5, +.type = AVMEDIA_TYPE_VIDEO, +.name = "imm5", +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), +.props = AV_CODEC_PROP_LOSSY, +}, /* various PCM "codecs" */ { diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c new file mode 100644 index 00..ab80516a4b --- /dev/null +++ b/libavcodec/imm5.c @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2019 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/intreadwrite.h" + +#include "avcodec.h" +#include "internal.h" + +typedef struct IMM5Context { +AVCodecContext *h264_avctx; // wrapper context for H264 +AVCodecContext *hevc_avctx; // wrapper context for HEVC +} IMM5Context; + +static const struct IMM5_unit { +uint8_t bits[14]; +uint8_t len; +} IMM5_units[14] = { +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x0F, 0x88 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x83, 0xE2 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, 0xE8, 0x80 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x04, 0xA2 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, 0x28, 0x80 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x80, 0x92, 0x20 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00, 0x1E, 0x9A, 0x74, 0x0B, 0x0F, 0xC8 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00, 0x1E, 0x9A, 0x74, 0x05, 0x83, 0xF2 }, 13 }, +{ { 0x00, 0x00, 0x00,
[FFmpeg-devel] [PATCH v2] avformat/movenc: always write a colr atom
It hasn't been experimental for a long time. Closes ticket #7961 Signed-off-by: James Almer --- Decided to deprecate the flag and making it a no-op instead of changing its behavior to be enabled by default. Otherwise doing something like "-movflags faststart" instead of "-movflags +faststart" would disable it. libavformat/movenc.c | 10 +- libavformat/movenc.h | 1 - tests/fate/mov.mak| 2 +- tests/fate/vcodec.mak | 8 +- tests/ref/fate/copy-trac236 | 4 +- tests/ref/fate/movenc | 102 +- tests/ref/fate/prores-metadata| 2 +- tests/ref/lavf-fate/qtrle_mace6.mov | 4 +- tests/ref/lavf/mov| 12 +-- tests/ref/lavf/mov_rtphint| 4 +- tests/ref/lavf/mp4| 12 +-- tests/ref/seek/lavf-mov | 44 tests/ref/vsynth/vsynth1-avui | 4 +- tests/ref/vsynth/vsynth1-dnxhd-1080i | 8 +- tests/ref/vsynth/vsynth1-dnxhd-1080i-10bit| 4 +- tests/ref/vsynth/vsynth1-dnxhd-1080i-colr | 4 - tests/ref/vsynth/vsynth1-dnxhd-hr-hq-mov | 4 +- tests/ref/vsynth/vsynth1-dnxhd-hr-lb-mov | 4 +- tests/ref/vsynth/vsynth1-dnxhd-hr-sq-mov | 4 +- tests/ref/vsynth/vsynth1-mov-bgr24| 4 +- tests/ref/vsynth/vsynth1-mov-bpp15| 4 +- tests/ref/vsynth/vsynth1-mov-bpp16| 4 +- tests/ref/vsynth/vsynth1-mpeg4| 4 +- tests/ref/vsynth/vsynth1-prores | 4 +- tests/ref/vsynth/vsynth1-prores_444 | 4 +- tests/ref/vsynth/vsynth1-prores_444_int | 4 +- tests/ref/vsynth/vsynth1-prores_int | 4 +- tests/ref/vsynth/vsynth1-prores_ks| 4 +- tests/ref/vsynth/vsynth1-qtrle| 4 +- tests/ref/vsynth/vsynth1-qtrlegray| 4 +- tests/ref/vsynth/vsynth1-svq1 | 4 +- tests/ref/vsynth/vsynth1-vc2-420p | 4 +- tests/ref/vsynth/vsynth1-vc2-420p10 | 4 +- tests/ref/vsynth/vsynth1-vc2-420p12 | 4 +- tests/ref/vsynth/vsynth1-vc2-422p | 4 +- tests/ref/vsynth/vsynth1-vc2-422p10 | 4 +- tests/ref/vsynth/vsynth1-vc2-422p12 | 4 +- tests/ref/vsynth/vsynth1-vc2-444p | 4 +- tests/ref/vsynth/vsynth1-vc2-444p10 | 4 +- tests/ref/vsynth/vsynth1-vc2-444p12 | 4 +- tests/ref/vsynth/vsynth1-vc2-t5_3 | 4 +- tests/ref/vsynth/vsynth1-vc2-thaar| 4 +- tests/ref/vsynth/vsynth2-avui | 4 +- tests/ref/vsynth/vsynth2-dnxhd-1080i | 8 +- tests/ref/vsynth/vsynth2-dnxhd-1080i-10bit| 4 +- tests/ref/vsynth/vsynth2-dnxhd-1080i-colr | 4 - tests/ref/vsynth/vsynth2-dnxhd-hr-hq-mov | 4 +- tests/ref/vsynth/vsynth2-dnxhd-hr-lb-mov | 4 +- tests/ref/vsynth/vsynth2-dnxhd-hr-sq-mov | 4 +- tests/ref/vsynth/vsynth2-mov-bgr24| 4 +- tests/ref/vsynth/vsynth2-mov-bpp15| 4 +- tests/ref/vsynth/vsynth2-mov-bpp16| 4 +- tests/ref/vsynth/vsynth2-mpeg4| 4 +- tests/ref/vsynth/vsynth2-prores | 4 +- tests/ref/vsynth/vsynth2-prores_444 | 4 +- tests/ref/vsynth/vsynth2-prores_444_int | 4 +- tests/ref/vsynth/vsynth2-prores_int | 4 +- tests/ref/vsynth/vsynth2-prores_ks| 4 +- tests/ref/vsynth/vsynth2-qtrle| 4 +- tests/ref/vsynth/vsynth2-qtrlegray| 4 +- tests/ref/vsynth/vsynth2-svq1 | 4 +- tests/ref/vsynth/vsynth2-vc2-420p | 4 +- tests/ref/vsynth/vsynth2-vc2-420p10 | 4 +- tests/ref/vsynth/vsynth2-vc2-420p12 | 4 +- tests/ref/vsynth/vsynth2-vc2-422p | 4 +- tests/ref/vsynth/vsynth2-vc2-422p10 | 4 +- tests/ref/vsynth/vsynth2-vc2-422p12 | 4 +- tests/ref/vsynth/vsynth2-vc2-444p | 4 +- tests/ref/vsynth/vsynth2-vc2-444p10 | 4 +- tests/ref/vsynth/vsynth2-vc2-444p12 | 4 +- tests/ref/vsynth/vsynth2-vc2-t5_3 | 4 +- tests/ref/vsynth/vsynth2-vc2-thaar| 4 +- tests/ref/vsynth/vsynth3-dnxhd-1080i-10bit| 4 +- tests/ref/vsynth/vsynth3-dnxhd-1080i-colr | 4 - tests/ref/vsynth/vsynth3-dnxhd-hr-hq-mov | 4 +- tests/ref/vsynth/vsynth3-dnxhd-hr-lb-mov | 4 +- tests/ref/vsynth/vsynth3-dnxhd-hr-sq-mov | 4 +- tests/ref/vsynth/vsynth3-mov-bgr24| 4 +- tests/ref/vsynth/vsynth3-mov-bpp15| 4 +- tests/ref/vsynth/vsynth3-mov-bpp16| 4 +- tests/ref/vsynth/vsynth3-mpeg4| 4 +- tests/ref/vsynth/vsynth3-prores | 4 +- tests/ref/vsynth/vsynth3-prores_444 | 4 +-
Re: [FFmpeg-devel] [PATCH] avformat/movenc: always write a colr atom
On 7/16/2019 12:41 PM, Dave Rice wrote: > Hi James, > >> On Jul 16, 2019, at 9:47 AM, James Almer wrote: >> >> -{ "write_colr", "Write colr atom (Experimental, may be renamed or >> changed, do not use from scripts)", 0, AV_OPT_TYPE_CONST, {.i64 = >> FF_MOV_FLAG_WRITE_COLR}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, >> "movflags" }, > > The comment said specifically not to use this option in scripts; however, > there were ffmpeg users (I admit myself as one) who wanted both to use > scripts and write valid QuickTime files with colr data. I’d suggest > permitting the option to remain but to change the default behavior from > disabled to enabled. If I understand correctly, after this patch, encoding > with `-movflags write_colr` would cause ffmpeg to fail with an error from the > mov muxer. Alright, I'll do that. > > Dave > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/movenc: always write a colr atom
Hi James, > On Jul 16, 2019, at 9:47 AM, James Almer wrote: > > -{ "write_colr", "Write colr atom (Experimental, may be renamed or > changed, do not use from scripts)", 0, AV_OPT_TYPE_CONST, {.i64 = > FF_MOV_FLAG_WRITE_COLR}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, > "movflags" }, The comment said specifically not to use this option in scripts; however, there were ffmpeg users (I admit myself as one) who wanted both to use scripts and write valid QuickTime files with colr data. I’d suggest permitting the option to remain but to change the default behavior from disabled to enabled. If I understand correctly, after this patch, encoding with `-movflags write_colr` would cause ffmpeg to fail with an error from the mov muxer. Dave ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/movenc: always write a colr atom
It hasn't been experimental for a long time. Closes ticket #7961 Signed-off-by: James Almer --- libavformat/movenc.c | 9 +- libavformat/movenc.h | 1 - tests/fate/mov.mak| 2 +- tests/fate/vcodec.mak | 8 +- tests/ref/fate/copy-trac236 | 4 +- tests/ref/fate/movenc | 102 +- tests/ref/fate/prores-metadata| 2 +- tests/ref/lavf-fate/qtrle_mace6.mov | 4 +- tests/ref/lavf/mov| 12 +-- tests/ref/lavf/mov_rtphint| 4 +- tests/ref/lavf/mp4| 12 +-- tests/ref/seek/lavf-mov | 44 tests/ref/vsynth/vsynth1-avui | 4 +- tests/ref/vsynth/vsynth1-dnxhd-1080i | 8 +- tests/ref/vsynth/vsynth1-dnxhd-1080i-10bit| 4 +- tests/ref/vsynth/vsynth1-dnxhd-1080i-colr | 4 - tests/ref/vsynth/vsynth1-dnxhd-hr-hq-mov | 4 +- tests/ref/vsynth/vsynth1-dnxhd-hr-lb-mov | 4 +- tests/ref/vsynth/vsynth1-dnxhd-hr-sq-mov | 4 +- tests/ref/vsynth/vsynth1-mov-bgr24| 4 +- tests/ref/vsynth/vsynth1-mov-bpp15| 4 +- tests/ref/vsynth/vsynth1-mov-bpp16| 4 +- tests/ref/vsynth/vsynth1-mpeg4| 4 +- tests/ref/vsynth/vsynth1-prores | 4 +- tests/ref/vsynth/vsynth1-prores_444 | 4 +- tests/ref/vsynth/vsynth1-prores_444_int | 4 +- tests/ref/vsynth/vsynth1-prores_int | 4 +- tests/ref/vsynth/vsynth1-prores_ks| 4 +- tests/ref/vsynth/vsynth1-qtrle| 4 +- tests/ref/vsynth/vsynth1-qtrlegray| 4 +- tests/ref/vsynth/vsynth1-svq1 | 4 +- tests/ref/vsynth/vsynth1-vc2-420p | 4 +- tests/ref/vsynth/vsynth1-vc2-420p10 | 4 +- tests/ref/vsynth/vsynth1-vc2-420p12 | 4 +- tests/ref/vsynth/vsynth1-vc2-422p | 4 +- tests/ref/vsynth/vsynth1-vc2-422p10 | 4 +- tests/ref/vsynth/vsynth1-vc2-422p12 | 4 +- tests/ref/vsynth/vsynth1-vc2-444p | 4 +- tests/ref/vsynth/vsynth1-vc2-444p10 | 4 +- tests/ref/vsynth/vsynth1-vc2-444p12 | 4 +- tests/ref/vsynth/vsynth1-vc2-t5_3 | 4 +- tests/ref/vsynth/vsynth1-vc2-thaar| 4 +- tests/ref/vsynth/vsynth2-avui | 4 +- tests/ref/vsynth/vsynth2-dnxhd-1080i | 8 +- tests/ref/vsynth/vsynth2-dnxhd-1080i-10bit| 4 +- tests/ref/vsynth/vsynth2-dnxhd-1080i-colr | 4 - tests/ref/vsynth/vsynth2-dnxhd-hr-hq-mov | 4 +- tests/ref/vsynth/vsynth2-dnxhd-hr-lb-mov | 4 +- tests/ref/vsynth/vsynth2-dnxhd-hr-sq-mov | 4 +- tests/ref/vsynth/vsynth2-mov-bgr24| 4 +- tests/ref/vsynth/vsynth2-mov-bpp15| 4 +- tests/ref/vsynth/vsynth2-mov-bpp16| 4 +- tests/ref/vsynth/vsynth2-mpeg4| 4 +- tests/ref/vsynth/vsynth2-prores | 4 +- tests/ref/vsynth/vsynth2-prores_444 | 4 +- tests/ref/vsynth/vsynth2-prores_444_int | 4 +- tests/ref/vsynth/vsynth2-prores_int | 4 +- tests/ref/vsynth/vsynth2-prores_ks| 4 +- tests/ref/vsynth/vsynth2-qtrle| 4 +- tests/ref/vsynth/vsynth2-qtrlegray| 4 +- tests/ref/vsynth/vsynth2-svq1 | 4 +- tests/ref/vsynth/vsynth2-vc2-420p | 4 +- tests/ref/vsynth/vsynth2-vc2-420p10 | 4 +- tests/ref/vsynth/vsynth2-vc2-420p12 | 4 +- tests/ref/vsynth/vsynth2-vc2-422p | 4 +- tests/ref/vsynth/vsynth2-vc2-422p10 | 4 +- tests/ref/vsynth/vsynth2-vc2-422p12 | 4 +- tests/ref/vsynth/vsynth2-vc2-444p | 4 +- tests/ref/vsynth/vsynth2-vc2-444p10 | 4 +- tests/ref/vsynth/vsynth2-vc2-444p12 | 4 +- tests/ref/vsynth/vsynth2-vc2-t5_3 | 4 +- tests/ref/vsynth/vsynth2-vc2-thaar| 4 +- tests/ref/vsynth/vsynth3-dnxhd-1080i-10bit| 4 +- tests/ref/vsynth/vsynth3-dnxhd-1080i-colr | 4 - tests/ref/vsynth/vsynth3-dnxhd-hr-hq-mov | 4 +- tests/ref/vsynth/vsynth3-dnxhd-hr-lb-mov | 4 +- tests/ref/vsynth/vsynth3-dnxhd-hr-sq-mov | 4 +- tests/ref/vsynth/vsynth3-mov-bgr24| 4 +- tests/ref/vsynth/vsynth3-mov-bpp15| 4 +- tests/ref/vsynth/vsynth3-mov-bpp16| 4 +- tests/ref/vsynth/vsynth3-mpeg4| 4 +- tests/ref/vsynth/vsynth3-prores | 4 +- tests/ref/vsynth/vsynth3-prores_444 | 4 +- tests/ref/vsynth/vsynth3-prores_444_int | 4 +- tests/ref/vsynth/vsynth3-prores_int | 4 +- tests/ref/vsynth/vsynth3-prores_ks| 4 +- tests/ref/vsynth/vsynth3-qtrle| 4 +-
Re: [FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
On 7/16/2019 10:42 AM, Paul B Mahol wrote: > On 7/16/19, James Almer wrote: >> On 7/16/2019 9:19 AM, Paul B Mahol wrote: >>> +ret = avcodec_receive_frame(codec_avctx, frame); >>> +if (ret < 0) >>> +return ret; >> >> avcodec_receive_frame() can return EAGAIN when the packet was consumed >> and there was no output, but you're using it within a decode2 API based >> decoder, which in that scenario must return avpkt->size with got_frame == 0. >> >> Both h264 and hevc set AV_CODEC_CAP_DELAY, but by setting threads to 1 >> you may be effectively forcing a 1:1 input/output scenario. Did you make >> sure no frames are lost at the end when decoding your samples, and that >> this function isn't returning EAGAIN at any point? > > It does not return EAGAIN for any sample that I have. Ok, good, so by keeping threads to 1 it should be safe. > >> >>> + >>> +avctx->pix_fmt = codec_avctx->pix_fmt; >>> +avctx->width = codec_avctx->width; >>> +avctx->height = codec_avctx->height; >> >> coded_width/height as well. Or just use ff_set_dimensions(). >> >> And what about other fields like sample_aspect_ratio, bit_rate, color >> information? > > All relevant stuff should be in AVFrame itself. > I will add more of missing stuff you mentioned. > >> >>> + >>> +*got_frame = 1; >>> + >>> +return avpkt->size; >>> +} >>> + >>> +static av_cold int imm5_close(AVCodecContext *avctx) >>> +{ >>> +IMM5Context *ctx = avctx->priv_data; >>> + >>> +avcodec_free_context(>h264_avctx); >>> +avcodec_free_context(>hevc_avctx); >>> + >>> +return 0; >>> +} >>> + >>> +AVCodec ff_imm5_decoder = { >>> +.name = "imm5", >>> +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), >>> +.type = AVMEDIA_TYPE_VIDEO, >>> +.id = AV_CODEC_ID_IMM5, >>> +.init = imm5_init, >>> +.decode = imm5_decode_frame, >>> +.close = imm5_close, >> >> Missing a flush callback. > > And what would it do? Call avcodec_flush_buffers() on both h264 and hevc contexts. > >> >>> +.priv_data_size = sizeof(IMM5Context), >>> +.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | >>> + FF_CODEC_CAP_INIT_CLEANUP, >> >> You could set DR1, and set both h264_avctx->get_buffer2 and >> hevc_avctx->get_buffer2 to avctx->get_buffer2, i think. >> > > Will try. > > >> >> >>> +}; >>> diff --git a/libavformat/riff.c b/libavformat/riff.c >>> index e755ad8d5f..610974ebf0 100644 >>> --- a/libavformat/riff.c >>> +++ b/libavformat/riff.c >>> @@ -488,6 +488,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { >>> { AV_CODEC_ID_AGM, MKTAG('A', 'G', 'M', '6') }, >>> { AV_CODEC_ID_AGM, MKTAG('A', 'G', 'M', '7') }, >>> { AV_CODEC_ID_LSCR, MKTAG('L', 'S', 'C', 'R') }, >>> +{ AV_CODEC_ID_IMM5, MKTAG('I', 'M', 'M', '5') }, >>> { AV_CODEC_ID_NONE, 0 } >>> }; >>> >>> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> To unsubscribe, visit link above, or email >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
On 7/16/19, Andreas Rheinhardt wrote: > Paul B Mahol: >> Signed-off-by: Paul B Mahol >> --- >> configure | 1 + >> libavcodec/Makefile | 1 + >> libavcodec/allcodecs.c | 1 + >> libavcodec/avcodec.h| 1 + >> libavcodec/codec_desc.c | 7 ++ >> libavcodec/imm5.c | 171 >> libavformat/riff.c | 1 + >> 7 files changed, 183 insertions(+) >> create mode 100644 libavcodec/imm5.c >> >> diff --git a/configure b/configure >> index 5a4f507246..d03cf43350 100755 >> --- a/configure >> +++ b/configure >> @@ -2714,6 +2714,7 @@ huffyuv_encoder_select="bswapdsp huffman >> huffyuvencdsp llvidencdsp" >> hymt_decoder_select="huffyuv_decoder" >> iac_decoder_select="imc_decoder" >> imc_decoder_select="bswapdsp fft mdct sinewin" >> +imm5_decoder_select="h264_decoder hevc_decoder" >> indeo3_decoder_select="hpeldsp" >> indeo4_decoder_select="ividsp" >> indeo5_decoder_select="ividsp" >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> index 3cd73fbcc6..39f4d9118c 100644 >> --- a/libavcodec/Makefile >> +++ b/libavcodec/Makefile >> @@ -393,6 +393,7 @@ OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o >> OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o >> OBJS-$(CONFIG_IMC_DECODER) += imc.o >> OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o >> +OBJS-$(CONFIG_IMM5_DECODER)+= imm5.o >> OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o >> OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o >> OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o >> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c >> index d2f9a39ce5..fe7f773925 100644 >> --- a/libavcodec/allcodecs.c >> +++ b/libavcodec/allcodecs.c >> @@ -158,6 +158,7 @@ extern AVCodec ff_hymt_decoder; >> extern AVCodec ff_idcin_decoder; >> extern AVCodec ff_iff_ilbm_decoder; >> extern AVCodec ff_imm4_decoder; >> +extern AVCodec ff_imm5_decoder; >> extern AVCodec ff_indeo2_decoder; >> extern AVCodec ff_indeo3_decoder; >> extern AVCodec ff_indeo4_decoder; >> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h >> index 2528bd89ab..da6f92b443 100644 >> --- a/libavcodec/avcodec.h >> +++ b/libavcodec/avcodec.h >> @@ -457,6 +457,7 @@ enum AVCodecID { >> AV_CODEC_ID_AGM, >> AV_CODEC_ID_LSCR, >> AV_CODEC_ID_VP4, >> +AV_CODEC_ID_IMM5, >> >> /* various PCM "codecs" */ >> AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at >> the start of audio codecs >> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c >> index 4d033c20ff..e6373be504 100644 >> --- a/libavcodec/codec_desc.c >> +++ b/libavcodec/codec_desc.c >> @@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] >> = { >> .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), >> .props = AV_CODEC_PROP_LOSSY, >> }, >> +{ >> +.id= AV_CODEC_ID_IMM5, >> +.type = AVMEDIA_TYPE_VIDEO, >> +.name = "imm5", >> +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), >> +.props = AV_CODEC_PROP_LOSSY, >> +}, >> >> /* various PCM "codecs" */ >> { >> diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c >> new file mode 100644 >> index 00..d1bac342d0 >> --- /dev/null >> +++ b/libavcodec/imm5.c >> @@ -0,0 +1,171 @@ >> +/* >> + * Copyright (c) 2019 Paul B Mahol >> + * >> + * This file is part of FFmpeg. >> + * >> + * FFmpeg is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU Lesser General Public >> + * License as published by the Free Software Foundation; either >> + * version 2.1 of the License, or (at your option) any later version. >> + * >> + * FFmpeg is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * Lesser General Public License for more details. >> + * >> + * You should have received a copy of the GNU Lesser General Public >> + * License along with FFmpeg; if not, write to the Free Software >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >> 02110-1301 USA >> + */ >> + >> +#include "libavutil/intreadwrite.h" >> + >> +#include "avcodec.h" >> +#include "internal.h" >> + >> +typedef struct IMM5Context { >> +AVCodecContext *h264_avctx; // wrapper context for H264 >> +AVCodecContext *hevc_avctx; // wrapper context for HEVC >> +} IMM5Context; >> + >> +static const struct IMM5_unit { >> +uint8_t bits[14]; >> +uint8_t len; >> +} IMM5_units[14] = { >> +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x0F, >> 0x88 }, 12 }, >> +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x83, >> 0xE2 }, 12 }, >> +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, >> 0xE8, 0x80 }, 13 }, >> +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B,
Re: [FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
On Tue, Jul 16, 2019 at 3:26 PM James Almer wrote: > > > +.priv_data_size = sizeof(IMM5Context), > > +.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | > > + FF_CODEC_CAP_INIT_CLEANUP, > > You could set DR1, and set both h264_avctx->get_buffer2 and > hevc_avctx->get_buffer2 to avctx->get_buffer2, i think. > Not sure thats safe, since the caller would then get called on the internal avctx, which might be rather unexpected. If you really wanted to offer get_buffer2, there would probably need to be a dummy call in between that takes it from the internal avctx and then re-calls get_buffer2 on the public avctx. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
On 7/16/19, James Almer wrote: > On 7/16/2019 9:19 AM, Paul B Mahol wrote: >> Signed-off-by: Paul B Mahol >> --- >> configure | 1 + >> libavcodec/Makefile | 1 + >> libavcodec/allcodecs.c | 1 + >> libavcodec/avcodec.h| 1 + >> libavcodec/codec_desc.c | 7 ++ >> libavcodec/imm5.c | 171 >> libavformat/riff.c | 1 + >> 7 files changed, 183 insertions(+) >> create mode 100644 libavcodec/imm5.c >> >> diff --git a/configure b/configure >> index 5a4f507246..d03cf43350 100755 >> --- a/configure >> +++ b/configure >> @@ -2714,6 +2714,7 @@ huffyuv_encoder_select="bswapdsp huffman >> huffyuvencdsp llvidencdsp" >> hymt_decoder_select="huffyuv_decoder" >> iac_decoder_select="imc_decoder" >> imc_decoder_select="bswapdsp fft mdct sinewin" >> +imm5_decoder_select="h264_decoder hevc_decoder" >> indeo3_decoder_select="hpeldsp" >> indeo4_decoder_select="ividsp" >> indeo5_decoder_select="ividsp" >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> index 3cd73fbcc6..39f4d9118c 100644 >> --- a/libavcodec/Makefile >> +++ b/libavcodec/Makefile >> @@ -393,6 +393,7 @@ OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o >> OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o >> OBJS-$(CONFIG_IMC_DECODER) += imc.o >> OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o >> +OBJS-$(CONFIG_IMM5_DECODER)+= imm5.o >> OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o >> OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o >> OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o >> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c >> index d2f9a39ce5..fe7f773925 100644 >> --- a/libavcodec/allcodecs.c >> +++ b/libavcodec/allcodecs.c >> @@ -158,6 +158,7 @@ extern AVCodec ff_hymt_decoder; >> extern AVCodec ff_idcin_decoder; >> extern AVCodec ff_iff_ilbm_decoder; >> extern AVCodec ff_imm4_decoder; >> +extern AVCodec ff_imm5_decoder; >> extern AVCodec ff_indeo2_decoder; >> extern AVCodec ff_indeo3_decoder; >> extern AVCodec ff_indeo4_decoder; >> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h >> index 2528bd89ab..da6f92b443 100644 >> --- a/libavcodec/avcodec.h >> +++ b/libavcodec/avcodec.h >> @@ -457,6 +457,7 @@ enum AVCodecID { >> AV_CODEC_ID_AGM, >> AV_CODEC_ID_LSCR, >> AV_CODEC_ID_VP4, >> +AV_CODEC_ID_IMM5, >> >> /* various PCM "codecs" */ >> AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at >> the start of audio codecs >> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c >> index 4d033c20ff..e6373be504 100644 >> --- a/libavcodec/codec_desc.c >> +++ b/libavcodec/codec_desc.c >> @@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] >> = { >> .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), >> .props = AV_CODEC_PROP_LOSSY, >> }, >> +{ >> +.id= AV_CODEC_ID_IMM5, >> +.type = AVMEDIA_TYPE_VIDEO, >> +.name = "imm5", >> +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), >> +.props = AV_CODEC_PROP_LOSSY, >> +}, >> >> /* various PCM "codecs" */ >> { >> diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c >> new file mode 100644 >> index 00..d1bac342d0 >> --- /dev/null >> +++ b/libavcodec/imm5.c >> @@ -0,0 +1,171 @@ >> +/* >> + * Copyright (c) 2019 Paul B Mahol >> + * >> + * This file is part of FFmpeg. >> + * >> + * FFmpeg is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU Lesser General Public >> + * License as published by the Free Software Foundation; either >> + * version 2.1 of the License, or (at your option) any later version. >> + * >> + * FFmpeg is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * Lesser General Public License for more details. >> + * >> + * You should have received a copy of the GNU Lesser General Public >> + * License along with FFmpeg; if not, write to the Free Software >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >> 02110-1301 USA >> + */ >> + >> +#include "libavutil/intreadwrite.h" >> + >> +#include "avcodec.h" >> +#include "internal.h" >> + >> +typedef struct IMM5Context { >> +AVCodecContext *h264_avctx; // wrapper context for H264 >> +AVCodecContext *hevc_avctx; // wrapper context for HEVC >> +} IMM5Context; >> + >> +static const struct IMM5_unit { >> +uint8_t bits[14]; >> +uint8_t len; >> +} IMM5_units[14] = { >> +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x0F, >> 0x88 }, 12 }, >> +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x83, >> 0xE2 }, 12 }, >> +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, >> 0xE8, 0x80 }, 13 }, >> +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42,
Re: [FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
On 7/16/2019 9:19 AM, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > configure | 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/avcodec.h| 1 + > libavcodec/codec_desc.c | 7 ++ > libavcodec/imm5.c | 171 > libavformat/riff.c | 1 + > 7 files changed, 183 insertions(+) > create mode 100644 libavcodec/imm5.c > > diff --git a/configure b/configure > index 5a4f507246..d03cf43350 100755 > --- a/configure > +++ b/configure > @@ -2714,6 +2714,7 @@ huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp > llvidencdsp" > hymt_decoder_select="huffyuv_decoder" > iac_decoder_select="imc_decoder" > imc_decoder_select="bswapdsp fft mdct sinewin" > +imm5_decoder_select="h264_decoder hevc_decoder" > indeo3_decoder_select="hpeldsp" > indeo4_decoder_select="ividsp" > indeo5_decoder_select="ividsp" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 3cd73fbcc6..39f4d9118c 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -393,6 +393,7 @@ OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o > OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o > OBJS-$(CONFIG_IMC_DECODER) += imc.o > OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o > +OBJS-$(CONFIG_IMM5_DECODER)+= imm5.o > OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o > OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o > OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index d2f9a39ce5..fe7f773925 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -158,6 +158,7 @@ extern AVCodec ff_hymt_decoder; > extern AVCodec ff_idcin_decoder; > extern AVCodec ff_iff_ilbm_decoder; > extern AVCodec ff_imm4_decoder; > +extern AVCodec ff_imm5_decoder; > extern AVCodec ff_indeo2_decoder; > extern AVCodec ff_indeo3_decoder; > extern AVCodec ff_indeo4_decoder; > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 2528bd89ab..da6f92b443 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -457,6 +457,7 @@ enum AVCodecID { > AV_CODEC_ID_AGM, > AV_CODEC_ID_LSCR, > AV_CODEC_ID_VP4, > +AV_CODEC_ID_IMM5, > > /* various PCM "codecs" */ > AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the > start of audio codecs > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c > index 4d033c20ff..e6373be504 100644 > --- a/libavcodec/codec_desc.c > +++ b/libavcodec/codec_desc.c > @@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] = { > .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), > .props = AV_CODEC_PROP_LOSSY, > }, > +{ > +.id= AV_CODEC_ID_IMM5, > +.type = AVMEDIA_TYPE_VIDEO, > +.name = "imm5", > +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), > +.props = AV_CODEC_PROP_LOSSY, > +}, > > /* various PCM "codecs" */ > { > diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c > new file mode 100644 > index 00..d1bac342d0 > --- /dev/null > +++ b/libavcodec/imm5.c > @@ -0,0 +1,171 @@ > +/* > + * Copyright (c) 2019 Paul B Mahol > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include "libavutil/intreadwrite.h" > + > +#include "avcodec.h" > +#include "internal.h" > + > +typedef struct IMM5Context { > +AVCodecContext *h264_avctx; // wrapper context for H264 > +AVCodecContext *hevc_avctx; // wrapper context for HEVC > +} IMM5Context; > + > +static const struct IMM5_unit { > +uint8_t bits[14]; > +uint8_t len; > +} IMM5_units[14] = { > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x0F, > 0x88 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x83, > 0xE2 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, > 0xE8, 0x80 }, 13 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x04, > 0xA2 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, > 0x28, 0x80 }, 13 }, > +{ {
Re: [FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
Paul B Mahol: > Signed-off-by: Paul B Mahol > --- > configure | 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/avcodec.h| 1 + > libavcodec/codec_desc.c | 7 ++ > libavcodec/imm5.c | 171 > libavformat/riff.c | 1 + > 7 files changed, 183 insertions(+) > create mode 100644 libavcodec/imm5.c > > diff --git a/configure b/configure > index 5a4f507246..d03cf43350 100755 > --- a/configure > +++ b/configure > @@ -2714,6 +2714,7 @@ huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp > llvidencdsp" > hymt_decoder_select="huffyuv_decoder" > iac_decoder_select="imc_decoder" > imc_decoder_select="bswapdsp fft mdct sinewin" > +imm5_decoder_select="h264_decoder hevc_decoder" > indeo3_decoder_select="hpeldsp" > indeo4_decoder_select="ividsp" > indeo5_decoder_select="ividsp" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 3cd73fbcc6..39f4d9118c 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -393,6 +393,7 @@ OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o > OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o > OBJS-$(CONFIG_IMC_DECODER) += imc.o > OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o > +OBJS-$(CONFIG_IMM5_DECODER)+= imm5.o > OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o > OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o > OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index d2f9a39ce5..fe7f773925 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -158,6 +158,7 @@ extern AVCodec ff_hymt_decoder; > extern AVCodec ff_idcin_decoder; > extern AVCodec ff_iff_ilbm_decoder; > extern AVCodec ff_imm4_decoder; > +extern AVCodec ff_imm5_decoder; > extern AVCodec ff_indeo2_decoder; > extern AVCodec ff_indeo3_decoder; > extern AVCodec ff_indeo4_decoder; > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 2528bd89ab..da6f92b443 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -457,6 +457,7 @@ enum AVCodecID { > AV_CODEC_ID_AGM, > AV_CODEC_ID_LSCR, > AV_CODEC_ID_VP4, > +AV_CODEC_ID_IMM5, > > /* various PCM "codecs" */ > AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the > start of audio codecs > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c > index 4d033c20ff..e6373be504 100644 > --- a/libavcodec/codec_desc.c > +++ b/libavcodec/codec_desc.c > @@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] = { > .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), > .props = AV_CODEC_PROP_LOSSY, > }, > +{ > +.id= AV_CODEC_ID_IMM5, > +.type = AVMEDIA_TYPE_VIDEO, > +.name = "imm5", > +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), > +.props = AV_CODEC_PROP_LOSSY, > +}, > > /* various PCM "codecs" */ > { > diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c > new file mode 100644 > index 00..d1bac342d0 > --- /dev/null > +++ b/libavcodec/imm5.c > @@ -0,0 +1,171 @@ > +/* > + * Copyright (c) 2019 Paul B Mahol > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include "libavutil/intreadwrite.h" > + > +#include "avcodec.h" > +#include "internal.h" > + > +typedef struct IMM5Context { > +AVCodecContext *h264_avctx; // wrapper context for H264 > +AVCodecContext *hevc_avctx; // wrapper context for HEVC > +} IMM5Context; > + > +static const struct IMM5_unit { > +uint8_t bits[14]; > +uint8_t len; > +} IMM5_units[14] = { > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x0F, > 0x88 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x83, > 0xE2 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, > 0xE8, 0x80 }, 13 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x04, > 0xA2 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, > 0x28, 0x80 }, 13 }, > +{ { 0x00, 0x00, 0x00, 0x01,
[FFmpeg-devel] [PATCH] avformat/mux: correct error msg for when BSF filtering fails
From ec6225cfe6fd139518de6699ea5ded57d9dbae2a Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Tue, 16 Jul 2019 18:06:42 +0530 Subject: [PATCH] avformat/mux: correct error msg for when BSF filtering fails --- libavformat/mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index 21f10caf53..8ab5ea8c2b 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -865,7 +865,7 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) { if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) return 0; av_log(ctx, AV_LOG_ERROR, -"Failed to send packet to filter %s for stream %d\n", +"Failed to receive packet from filter %s for stream %d\n", ctx->filter->name, pkt->stream_index); if (s->error_recognition & AV_EF_EXPLODE) return ret; -- 2.22.0___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
Signed-off-by: Paul B Mahol --- configure | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h| 1 + libavcodec/codec_desc.c | 7 ++ libavcodec/imm5.c | 171 libavformat/riff.c | 1 + 7 files changed, 183 insertions(+) create mode 100644 libavcodec/imm5.c diff --git a/configure b/configure index 5a4f507246..d03cf43350 100755 --- a/configure +++ b/configure @@ -2714,6 +2714,7 @@ huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" hymt_decoder_select="huffyuv_decoder" iac_decoder_select="imc_decoder" imc_decoder_select="bswapdsp fft mdct sinewin" +imm5_decoder_select="h264_decoder hevc_decoder" indeo3_decoder_select="hpeldsp" indeo4_decoder_select="ividsp" indeo5_decoder_select="ividsp" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3cd73fbcc6..39f4d9118c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -393,6 +393,7 @@ OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o OBJS-$(CONFIG_IMC_DECODER) += imc.o OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o +OBJS-$(CONFIG_IMM5_DECODER)+= imm5.o OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39ce5..fe7f773925 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -158,6 +158,7 @@ extern AVCodec ff_hymt_decoder; extern AVCodec ff_idcin_decoder; extern AVCodec ff_iff_ilbm_decoder; extern AVCodec ff_imm4_decoder; +extern AVCodec ff_imm5_decoder; extern AVCodec ff_indeo2_decoder; extern AVCodec ff_indeo3_decoder; extern AVCodec ff_indeo4_decoder; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 2528bd89ab..da6f92b443 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -457,6 +457,7 @@ enum AVCodecID { AV_CODEC_ID_AGM, AV_CODEC_ID_LSCR, AV_CODEC_ID_VP4, +AV_CODEC_ID_IMM5, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 4d033c20ff..e6373be504 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), .props = AV_CODEC_PROP_LOSSY, }, +{ +.id= AV_CODEC_ID_IMM5, +.type = AVMEDIA_TYPE_VIDEO, +.name = "imm5", +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), +.props = AV_CODEC_PROP_LOSSY, +}, /* various PCM "codecs" */ { diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c new file mode 100644 index 00..d1bac342d0 --- /dev/null +++ b/libavcodec/imm5.c @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2019 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/intreadwrite.h" + +#include "avcodec.h" +#include "internal.h" + +typedef struct IMM5Context { +AVCodecContext *h264_avctx; // wrapper context for H264 +AVCodecContext *hevc_avctx; // wrapper context for HEVC +} IMM5Context; + +static const struct IMM5_unit { +uint8_t bits[14]; +uint8_t len; +} IMM5_units[14] = { +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x0F, 0x88 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x83, 0xE2 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, 0xE8, 0x80 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x04, 0xA2 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, 0x28, 0x80 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x80, 0x92, 0x20 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00, 0x1E, 0x9A, 0x74, 0x0B, 0x0F, 0xC8 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00, 0x1E, 0x9A, 0x74, 0x05, 0x83, 0xF2 }, 13 }, +{ { 0x00, 0x00, 0x00,
Re: [FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
Paul B Mahol: > Signed-off-by: Paul B Mahol > --- > configure | 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/avcodec.h| 1 + > libavcodec/codec_desc.c | 7 ++ > libavcodec/imm5.c | 175 > libavformat/riff.c | 1 + > 7 files changed, 187 insertions(+) > create mode 100644 libavcodec/imm5.c > > diff --git a/configure b/configure > index 5a4f507246..d03cf43350 100755 > --- a/configure > +++ b/configure > @@ -2714,6 +2714,7 @@ huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp > llvidencdsp" > hymt_decoder_select="huffyuv_decoder" > iac_decoder_select="imc_decoder" > imc_decoder_select="bswapdsp fft mdct sinewin" > +imm5_decoder_select="h264_decoder hevc_decoder" > indeo3_decoder_select="hpeldsp" > indeo4_decoder_select="ividsp" > indeo5_decoder_select="ividsp" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 3cd73fbcc6..39f4d9118c 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -393,6 +393,7 @@ OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o > OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o > OBJS-$(CONFIG_IMC_DECODER) += imc.o > OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o > +OBJS-$(CONFIG_IMM5_DECODER)+= imm5.o > OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o > OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o > OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index d2f9a39ce5..fe7f773925 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -158,6 +158,7 @@ extern AVCodec ff_hymt_decoder; > extern AVCodec ff_idcin_decoder; > extern AVCodec ff_iff_ilbm_decoder; > extern AVCodec ff_imm4_decoder; > +extern AVCodec ff_imm5_decoder; > extern AVCodec ff_indeo2_decoder; > extern AVCodec ff_indeo3_decoder; > extern AVCodec ff_indeo4_decoder; > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 2528bd89ab..da6f92b443 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -457,6 +457,7 @@ enum AVCodecID { > AV_CODEC_ID_AGM, > AV_CODEC_ID_LSCR, > AV_CODEC_ID_VP4, > +AV_CODEC_ID_IMM5, > > /* various PCM "codecs" */ > AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the > start of audio codecs > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c > index 4d033c20ff..e6373be504 100644 > --- a/libavcodec/codec_desc.c > +++ b/libavcodec/codec_desc.c > @@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] = { > .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), > .props = AV_CODEC_PROP_LOSSY, > }, > +{ > +.id= AV_CODEC_ID_IMM5, > +.type = AVMEDIA_TYPE_VIDEO, > +.name = "imm5", > +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), > +.props = AV_CODEC_PROP_LOSSY, > +}, > > /* various PCM "codecs" */ > { > diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c > new file mode 100644 > index 00..9161c13ffc > --- /dev/null > +++ b/libavcodec/imm5.c > @@ -0,0 +1,175 @@ > +/* > + * Copyright (c) 2019 Paul B Mahol > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include "avcodec.h" > +#include "bytestream.h" This header seems unnecessary. > +#include "internal.h" > + > +typedef struct IMM5Context { > +AVCodecContext *h264_avctx; // wrapper context for H264 > +AVCodecContext *hevc_avctx; // wrapper context for HEVC > +} IMM5Context; > + > +static const struct IMM5_unit { > +uint8_t bits[14]; > +uint8_t len; > +} IMM5_units[14] = { > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x0F, > 0x88 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x83, > 0xE2 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, > 0xE8, 0x80 }, 13 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x04, > 0xA2 }, 12 }, > +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, > 0x28, 0x80 }, 13 }, > +{ { 0x00,
[FFmpeg-devel] [PATCH, v2 2/2] doc/ffmpeg.texi: update docs for autoscale/autorotate
Add docs for autoscale. Update information for autorotate according to ffplay. Signed-off-by: Linjie Fu --- doc/ffmpeg.texi | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index cd35eb49c8..b91da2b2b4 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -734,10 +734,6 @@ ffmpeg -dump_attachment:t "" -i INPUT Technical note -- attachments are implemented as codec extradata, so this option can actually be used to extract extradata from any stream, not just attachments. - -@item -noautorotate -Disable automatically rotating video based on file metadata. - @end table @section Video Options @@ -819,6 +815,16 @@ Create the filtergraph specified by @var{filtergraph} and use it to filter the stream. This is an alias for @code{-filter:v}, see the @ref{filter_option,,-filter option}. + +@item -autorotate +Automatically rotate the video according to file metadata. Enabled by +default, use @option{-noautorotate} to disable it. + +@item -autoscale +Automatically scale the video according to the resolution of first frame. +Enabled by default, use @option{-noautoscale} to disable it. Each frame of +the output raw video can be in different resolutions and is in need to be +handled next. @end table @section Advanced Video options -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/3] lavf/f_select: make the more pixel format usable to avoid autoscale to rgb
From: Limin Wang Have tested all available pixel format in the code: 1. AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8 are tested by autoscale with the fate sample: Vertical400kbit.sorenson3.mov pkt_pts=20040 scenecut haven't been detected for serveral format 2. AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUYV422, AV_PIX_FMT_YUV422P AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUYV42, AV_PIX_FMT_YUVJ422P are tested with my local samples 3. AV_PIX_FMT_YUVJ420P is tested with fate sample: Vertical400kbit.sorenson3.mov Signed-off-by: Limin Wang --- libavfilter/f_select.c | 6 +- tests/ref/fate/filter-metadata-scenedetect | 16 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index eed8df34cb..3ec26c68c3 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -498,7 +498,11 @@ static int query_formats(AVFilterContext *ctx) } else { int ret; static const enum AVPixelFormat pix_fmts[] = { -AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, +AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA, +AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, +AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUYV422, +AV_PIX_FMT_YUV422P, AV_PIX_FMT_NV12, AV_PIX_FMT_P010, +AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_NONE }; AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); diff --git a/tests/ref/fate/filter-metadata-scenedetect b/tests/ref/fate/filter-metadata-scenedetect index 67c23b3c32..7ce2d6794e 100644 --- a/tests/ref/fate/filter-metadata-scenedetect +++ b/tests/ref/fate/filter-metadata-scenedetect @@ -1,11 +1,11 @@ pkt_pts=1620|tag:lavfi.scene_score=1.00 -pkt_pts=4140|tag:lavfi.scene_score=0.875036 -pkt_pts=5800|tag:lavfi.scene_score=1.00 -pkt_pts=6720|tag:lavfi.scene_score=0.461625 -pkt_pts=8160|tag:lavfi.scene_score=1.00 -pkt_pts=9760|tag:lavfi.scene_score=1.00 -pkt_pts=14080|tag:lavfi.scene_score=0.838916 +pkt_pts=4140|tag:lavfi.scene_score=0.668643 +pkt_pts=5800|tag:lavfi.scene_score=0.996721 +pkt_pts=6720|tag:lavfi.scene_score=0.357390 +pkt_pts=8160|tag:lavfi.scene_score=0.886268 +pkt_pts=9760|tag:lavfi.scene_score=0.926219 +pkt_pts=14080|tag:lavfi.scene_score=0.650033 pkt_pts=15700|tag:lavfi.scene_score=1.00 -pkt_pts=18500|tag:lavfi.scene_score=0.474948 -pkt_pts=20040|tag:lavfi.scene_score=0.379700 +pkt_pts=18500|tag:lavfi.scene_score=0.316402 +pkt_pts=20040|tag:lavfi.scene_score=0.269509 pkt_pts=21760|tag:lavfi.scene_score=1.00 -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
On Tue, Jul 16, 2019 at 11:57:36AM +0200, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > configure | 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/avcodec.h| 1 + > libavcodec/codec_desc.c | 7 ++ > libavcodec/imm5.c | 175 > libavformat/riff.c | 1 + > 7 files changed, 187 insertions(+) > create mode 100644 libavcodec/imm5.c > > diff --git a/configure b/configure > + > +if (index >= 1 && index <= 12) { > +index -= 1; > +off = offset = IMM5_units[index].len; > +if (codec_type == 2) { > +offset += IMM5_units[12].len; > +} else { > +offset += IMM5_units[13].len; > +} > + > +buf += 24 - offset; > +buf_size = new_size + offset; > + > +memcpy(buf, IMM5_units[index].bits, IMM5_units[index].len); > +if (codec_type == 2) { > +memcpy(buf + off, IMM5_units[12].bits, IMM5_units[12].len); > +} else { > +memcpy(buf + off, IMM5_units[13].bits, IMM5_units[13].len); > +} this all looks pretty good. without trying to nitpick it forever, i suggest replacing the (codec_type==2) blocks. index2 = codec_type2 == 2 ? 12 : 13; offset += IMM5_units[index2].len; ... memcpy(buf + off, IMM5_units[index2].bits, IMM5_units[index2].len); -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder
Signed-off-by: Paul B Mahol --- configure | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h| 1 + libavcodec/codec_desc.c | 7 ++ libavcodec/imm5.c | 175 libavformat/riff.c | 1 + 7 files changed, 187 insertions(+) create mode 100644 libavcodec/imm5.c diff --git a/configure b/configure index 5a4f507246..d03cf43350 100755 --- a/configure +++ b/configure @@ -2714,6 +2714,7 @@ huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" hymt_decoder_select="huffyuv_decoder" iac_decoder_select="imc_decoder" imc_decoder_select="bswapdsp fft mdct sinewin" +imm5_decoder_select="h264_decoder hevc_decoder" indeo3_decoder_select="hpeldsp" indeo4_decoder_select="ividsp" indeo5_decoder_select="ividsp" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3cd73fbcc6..39f4d9118c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -393,6 +393,7 @@ OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o OBJS-$(CONFIG_IMC_DECODER) += imc.o OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o +OBJS-$(CONFIG_IMM5_DECODER)+= imm5.o OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39ce5..fe7f773925 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -158,6 +158,7 @@ extern AVCodec ff_hymt_decoder; extern AVCodec ff_idcin_decoder; extern AVCodec ff_iff_ilbm_decoder; extern AVCodec ff_imm4_decoder; +extern AVCodec ff_imm5_decoder; extern AVCodec ff_indeo2_decoder; extern AVCodec ff_indeo3_decoder; extern AVCodec ff_indeo4_decoder; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 2528bd89ab..da6f92b443 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -457,6 +457,7 @@ enum AVCodecID { AV_CODEC_ID_AGM, AV_CODEC_ID_LSCR, AV_CODEC_ID_VP4, +AV_CODEC_ID_IMM5, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 4d033c20ff..e6373be504 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1726,6 +1726,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("On2 VP4"), .props = AV_CODEC_PROP_LOSSY, }, +{ +.id= AV_CODEC_ID_IMM5, +.type = AVMEDIA_TYPE_VIDEO, +.name = "imm5", +.long_name = NULL_IF_CONFIG_SMALL("Infinity IMM5"), +.props = AV_CODEC_PROP_LOSSY, +}, /* various PCM "codecs" */ { diff --git a/libavcodec/imm5.c b/libavcodec/imm5.c new file mode 100644 index 00..9161c13ffc --- /dev/null +++ b/libavcodec/imm5.c @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2019 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avcodec.h" +#include "bytestream.h" +#include "internal.h" + +typedef struct IMM5Context { +AVCodecContext *h264_avctx; // wrapper context for H264 +AVCodecContext *hevc_avctx; // wrapper context for HEVC +} IMM5Context; + +static const struct IMM5_unit { +uint8_t bits[14]; +uint8_t len; +} IMM5_units[14] = { +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x0F, 0x88 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x83, 0xE2 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, 0xE8, 0x80 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x0B, 0x04, 0xA2 }, 12 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x81, 0x28, 0x80 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x80, 0x1E, 0xF4, 0x05, 0x80, 0x92, 0x20 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00, 0x1E, 0x9A, 0x74, 0x0B, 0x0F, 0xC8 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67, 0x42, 0x00, 0x1E, 0x9A, 0x74, 0x05, 0x83, 0xF2 }, 13 }, +{ { 0x00, 0x00, 0x00, 0x01, 0x67,
Re: [FFmpeg-devel] dash: add descriptor which is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.
Let me add that, descriptor provides extensible syntax and semantics for describing Adaptation Set properties. In my scenario,I implemented one VR tiled video system using descriptor. leozhang 于2019年7月15日周一 上午11:11写道: > > change history: > 1. remove unnecessary cast. > 2. add some braces. > > Please comment, Thanks > > Signed-off-by: leozhang > --- > doc/muxers.texi | 3 +++ > libavformat/dashenc.c | 35 --- > 2 files changed, 35 insertions(+), 3 deletions(-) > > diff --git a/doc/muxers.texi b/doc/muxers.texi > index b109297..ac06ad2 100644 > --- a/doc/muxers.texi > +++ b/doc/muxers.texi > @@ -275,6 +275,9 @@ of the adaptation sets and a,b,c,d and e are the indices > of the mapped streams. > To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be > used as stream identifier instead of IDs. > > When no assignment is defined, this defaults to an AdaptationSet for each > stream. > + > +Optional syntax is "id=x,descriptor=descriptor_str,streams=a,b,c > id=y,streams=d,e" and so on, descriptor is useful to the scheme defined by > ISO/IEC 23009-1:2014/Amd.2:2015. > +And descriptor_str must be a properly formatted XML element, which is > encoded by base64. > @item timeout @var{timeout} > Set timeout for socket I/O operations. Applicable only for HTTP output. > @item index_correction @var{index_correction} > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > index b25afb4..a48031c 100644 > --- a/libavformat/dashenc.c > +++ b/libavformat/dashenc.c > @@ -34,6 +34,7 @@ > #include "libavutil/rational.h" > #include "libavutil/time.h" > #include "libavutil/time_internal.h" > +#include "libavutil/base64.h" > > #include "avc.h" > #include "avformat.h" > @@ -68,6 +69,7 @@ typedef struct Segment { > > typedef struct AdaptationSet { > char id[10]; > +char descriptor[1024]; > enum AVMediaType media_type; > AVDictionary *metadata; > AVRational min_frame_rate, max_frame_rate; > @@ -748,7 +750,8 @@ static int write_adaptation_set(AVFormatContext *s, > AVIOContext *out, int as_ind > role = av_dict_get(as->metadata, "role", NULL, 0); > if (role) > avio_printf(out, "\t\t\t schemeIdUri=\"urn:mpeg:dash:role:2011\" value=\"%s\"/>\n", role->value); > - > +if (strlen(as->descriptor)) > +avio_printf(out, "\t\t\t%s\n", as->descriptor); > for (i = 0; i < s->nb_streams; i++) { > OutputStream *os = >streams[i]; > char bandwidth_str[64] = {'\0'}; > @@ -820,7 +823,7 @@ static int parse_adaptation_sets(AVFormatContext *s) > { > DASHContext *c = s->priv_data; > const char *p = c->adaptation_sets; > -enum { new_set, parse_id, parsing_streams } state; > +enum { new_set, parse_id, parsing_streams, parse_descriptor } state; > AdaptationSet *as; > int i, n, ret; > > @@ -837,6 +840,9 @@ static int parse_adaptation_sets(AVFormatContext *s) > } > > // syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on > +// option id=0,descriptor=descriptor_str,streams=0,1,2 and so on > +// descriptor is useful to the scheme defined by ISO/IEC > 23009-1:2014/Amd.2:2015 > +// descriptor_str must be a properly formatted XML element, encoded by > base64. > state = new_set; > while (*p) { > if (*p == ' ') { > @@ -854,7 +860,30 @@ static int parse_adaptation_sets(AVFormatContext *s) > if (*p) > p++; > state = parse_id; > -} else if (state == parse_id && av_strstart(p, "streams=", )) { > +} else if (state == parse_id && av_strstart(p, "descriptor=", )) { > +char *encode_str, *decode_str; > +int decode_size, ret; > + > +n = strcspn(p, ","); > +encode_str = av_strndup(p, n); > +decode_size = AV_BASE64_DECODE_SIZE(n); > +decode_str = av_mallocz(decode_size); > +if (decode_str) { > +ret = av_base64_decode(decode_str, encode_str, decode_size); > +if (ret >= 0) > +snprintf(as->descriptor, sizeof(as->descriptor), "%.*s", > decode_size, decode_str); > +else > +av_log(s, AV_LOG_WARNING, "descriptor string is invalid > base64 encode\n"); > +} else { > +av_log(s, AV_LOG_WARNING, "av_mallocz failed, will not parse > descriptor\n"); > +} > +p += n; > +if (*p) > +p++; > +state = parse_descriptor; > +av_freep(_str); > +av_freep(_str); > +} else if ((state == parse_id || state == parse_descriptor) && > av_strstart(p, "streams=", )) { //descriptor is optional > state = parsing_streams; > } else if (state == parsing_streams) { > AdaptationSet *as = >as[c->nb_as - 1]; > -- > 1.8.3.1 > > ___ > ffmpeg-devel mailing list >
Re: [FFmpeg-devel] how to create sub project / git repo under FFMPEG
On Tue, Jul 16, 2019 at 06:07:58AM +, Guo, Yejun wrote: > Hi Michael, > > With the development of ffmpeg dnn module, there is a need to get a git repo, > controlled by FFMPEG, to hold dnn materials, such as training scripts, > trained parameters etc, as discussed at > http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245750.html. > > Could you please let me know how to create a sub project / git repo under > FFMPEG? thanks. I can create a git repo on git.ffmpeg.org assuming there is consensus that one should be created as well as a name for it One alternative is to use github or to ask jb about creating one on videolan Just depends on whatever people prefer ? Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "You are 36 times more likely to die in a bathtub than at the hands of a terrorist. Also, you are 2.5 times more likely to become a president and 2 times more likely to become an astronaut, than to die in a terrorist attack." -- Thoughty2 signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] lavf/f_select: make the more pixel format usable to avoid autoscale to rgb
Please nobody commit this, unless it is tested with every mentioned pixel format. On 7/16/19, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavfilter/f_select.c | 6 ++ > tests/ref/fate/filter-metadata-scenedetect | 16 > 2 files changed, 14 insertions(+), 8 deletions(-) > > diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c > index eed8df3..35aed3f 100644 > --- a/libavfilter/f_select.c > +++ b/libavfilter/f_select.c > @@ -499,6 +499,12 @@ static int query_formats(AVFilterContext *ctx) > int ret; > static const enum AVPixelFormat pix_fmts[] = { > AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, > +AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA, > +AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, > +AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, > +AV_PIX_FMT_YUYV422, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, > +AV_PIX_FMT_NV12, AV_PIX_FMT_NV21, AV_PIX_FMT_P010, > +AV_PIX_FMT_P016, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, > AV_PIX_FMT_NONE > }; > AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); > diff --git a/tests/ref/fate/filter-metadata-scenedetect > b/tests/ref/fate/filter-metadata-scenedetect > index 67c23b3..7ce2d67 100644 > --- a/tests/ref/fate/filter-metadata-scenedetect > +++ b/tests/ref/fate/filter-metadata-scenedetect > @@ -1,11 +1,11 @@ > pkt_pts=1620|tag:lavfi.scene_score=1.00 > -pkt_pts=4140|tag:lavfi.scene_score=0.875036 > -pkt_pts=5800|tag:lavfi.scene_score=1.00 > -pkt_pts=6720|tag:lavfi.scene_score=0.461625 > -pkt_pts=8160|tag:lavfi.scene_score=1.00 > -pkt_pts=9760|tag:lavfi.scene_score=1.00 > -pkt_pts=14080|tag:lavfi.scene_score=0.838916 > +pkt_pts=4140|tag:lavfi.scene_score=0.668643 > +pkt_pts=5800|tag:lavfi.scene_score=0.996721 > +pkt_pts=6720|tag:lavfi.scene_score=0.357390 > +pkt_pts=8160|tag:lavfi.scene_score=0.886268 > +pkt_pts=9760|tag:lavfi.scene_score=0.926219 > +pkt_pts=14080|tag:lavfi.scene_score=0.650033 > pkt_pts=15700|tag:lavfi.scene_score=1.00 > -pkt_pts=18500|tag:lavfi.scene_score=0.474948 > -pkt_pts=20040|tag:lavfi.scene_score=0.379700 > +pkt_pts=18500|tag:lavfi.scene_score=0.316402 > +pkt_pts=20040|tag:lavfi.scene_score=0.269509 > pkt_pts=21760|tag:lavfi.scene_score=1.00 > -- > 2.6.4 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 2/2] lavfi: addroi filter
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > Mark Thompson > Sent: Monday, July 08, 2019 3:27 AM > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH v4 2/2] lavfi: addroi filter > > This can be used to add region of interest side data to video frames. > --- > doc/filters.texi | 73 +++ > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vf_addroi.c | 269 +++ > 4 files changed, 344 insertions(+) > create mode 100644 libavfilter/vf_addroi.c > > diff --git a/doc/filters.texi b/doc/filters.texi > index ee6a93ffbf..f7145532c7 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -5876,6 +5876,79 @@ build. > > Below is a description of the currently available video filters. > > +@section addroi > + > +Mark a region of interest in a video frame. > + > +The frame data is passed through unchanged, but metadata is attached > +to the frame indicating regions of interest which can affect the > +behaviour of later encoding. Multiple regions can be marked by > +applying the filter multiple times. > + > +@table @option > +@item x > +Region distance in pixels from the left edge of the frame. > +@item y > +Region distance in pixels from the top edge of the frame. > +@item w > +Region width in pixels. > +@item h > +Region height in pixels. > + > +The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions, > +and may contain the following variables: > +@table @option > +@item iw > +Width of the input frame. > +@item ih > +Height of the input frame. > +@end table > + > +@item qoffset > +Quantisation offset to apply within the region. > + > +This must be a real value in the range -1 to +1. A value of zero > +indicates no quality change. A negative value asks for better quality > +(less quantisation), while a positive value asks for worse quality > +(greater quantisation). > + > +The range is calibrated so that the extreme values indicate the > +largest possible offset - if the rest of the frame is encoded with the > +worst possible quality, an offset of -1 indicates that this region > +should be encoded with the best possible quality anyway. Intermediate > +values are then interpolated in some codec-dependent way. > + > +For example, in 10-bit H.264 the quantisation parameter varies between > +-12 and 51. A typical qoffset value of -1/10 therefore indicates that > +this region should be encoded with a QP around one-tenth of the full > +range better than the rest of the frame. So, if most of the frame > +were to be encoded with a QP of around 30, this region would get a QP > +of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3). > +An extreme value of -1 would indicate that this region should be > +encoded with the best possible quality regardless of the treatment of > +the rest of the frame - that is, should be encoded at a QP of -12. > +@item clear > +If set to true, remove any existing regions of interest marked on the > +frame before adding the new one. > +@end table > + > +@subsection Examples > + > +@itemize > +@item > +Mark the centre quarter of the frame as interesting. > +@example > +addroi=iw/4:ih/4:iw/2:ih/2:-1/10 > +@end example > +@item > +Mark the 100-pixel-wide region on the left edge of the frame as very > +uninteresting (to be encoded at much lower quality than the rest of > +the frame). > +@example > +addroi=0:0:100:ih:+1/5 > +@end example > +@end itemize > + > @section alphaextract > > Extract the alpha component from the input as a grayscale video. This > diff --git a/libavfilter/Makefile b/libavfilter/Makefile > index 455c809b15..00c402c3bc 100644 > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -152,6 +152,7 @@ OBJS-$(CONFIG_SINE_FILTER) > += asrc_sine.o > OBJS-$(CONFIG_ANULLSINK_FILTER) += asink_anullsink.o > > # video filters > +OBJS-$(CONFIG_ADDROI_FILTER) += vf_addroi.o > OBJS-$(CONFIG_ALPHAEXTRACT_FILTER) += vf_extractplanes.o > OBJS-$(CONFIG_ALPHAMERGE_FILTER) += vf_alphamerge.o > OBJS-$(CONFIG_AMPLIFY_FILTER)+= vf_amplify.o > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c > index 04a3df7d56..abd726d616 100644 > --- a/libavfilter/allfilters.c > +++ b/libavfilter/allfilters.c > @@ -143,6 +143,7 @@ extern AVFilter ff_asrc_sine; > > extern AVFilter ff_asink_anullsink; > > +extern AVFilter ff_vf_addroi; > extern AVFilter ff_vf_alphaextract; > extern AVFilter ff_vf_alphamerge; > extern AVFilter ff_vf_amplify; > diff --git a/libavfilter/vf_addroi.c b/libavfilter/vf_addroi.c > new file mode 100644 > index 00..489998ce73 > --- /dev/null > +++ b/libavfilter/vf_addroi.c > @@ -0,0 +1,269 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as
Re: [FFmpeg-devel] [PATCH v4 1/2] vaapi_encode: Add ROI support
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > Mark Thompson > Sent: Monday, July 08, 2019 3:27 AM > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH v4 1/2] vaapi_encode: Add ROI support > > --- > libavcodec/vaapi_encode.c | 118 > > libavcodec/vaapi_encode.h | 18 + > libavcodec/vaapi_encode_h264.c | 2 + > libavcodec/vaapi_encode_h265.c | 2 + > libavcodec/vaapi_encode_mpeg2.c | 2 + > libavcodec/vaapi_encode_vp8.c | 2 + > libavcodec/vaapi_encode_vp9.c | 2 + > 7 files changed, 146 insertions(+) > > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c > index dd2a24de04..41de023226 100644 > --- a/libavcodec/vaapi_encode.c > +++ b/libavcodec/vaapi_encode.c > @@ -166,6 +166,7 @@ static int vaapi_encode_issue(AVCodecContext *avctx, > int err, i; > char data[MAX_PARAM_BUFFER_SIZE]; > size_t bit_len; > +av_unused AVFrameSideData *sd; > > av_log(avctx, AV_LOG_DEBUG, "Issuing encode for > pic %"PRId64"/%"PRId64" " > "as type %s.\n", pic->display_order, pic->encode_order, > @@ -435,6 +436,71 @@ static int vaapi_encode_issue(AVCodecContext > *avctx, > } > } > > +#if VA_CHECK_VERSION(1, 0, 0) > +sd = av_frame_get_side_data(pic->input_image, > + > AV_FRAME_DATA_REGIONS_OF_INTEREST); > +if (sd && ctx->roi_allowed) { > +const AVRegionOfInterest *roi; > +uint32_t roi_size; > +VAEncMiscParameterBufferROI param_roi; > +int nb_roi, i, v; > + > +roi = (const AVRegionOfInterest*)sd->data; > +roi_size = roi->self_size; > +av_assert0(roi_size && sd->size % roi_size == 0); > +nb_roi = sd->size / roi_size; > +if (nb_roi > ctx->roi_max_regions) { > +if (!ctx->roi_warned) { > +av_log(avctx, AV_LOG_WARNING, "More ROIs set than " > + "supported by driver (%d > %d).\n", > + nb_roi, ctx->roi_max_regions); > +ctx->roi_warned = 1; > +} > +nb_roi = ctx->roi_max_regions; > +} > + > +pic->roi = av_mallocz_array(nb_roi, sizeof(*pic->roi)); > +if (!pic->roi) { > +err = AVERROR(ENOMEM); > +goto fail; > +} > +// For overlapping regions, the first in the array takes priority. > +for (i = 0; i < nb_roi; i++) { > +roi = (const AVRegionOfInterest*)(sd->data + roi_size * i); > + > +av_assert0(roi->qoffset.den != 0); > +v = roi->qoffset.num * ctx->roi_quant_range / roi->qoffset.den; > +av_log(avctx, AV_LOG_DEBUG, "ROI: (%d,%d)-(%d,%d) > -> %+d.\n", > + roi->top, roi->left, roi->bottom, roi->right, v); > + > +pic->roi[i] = (VAEncROI) { > +.roi_rectangle = { > +.x = roi->left, > +.y = roi->top, > +.width = roi->right - roi->left, > +.height = roi->bottom - roi->top, > +}, > +.roi_value = av_clip_c(v, INT8_MIN, INT8_MAX), > +}; > +} > + > +param_roi = (VAEncMiscParameterBufferROI) { > +.num_roi = nb_roi, > +.max_delta_qp = INT8_MAX, > +.min_delta_qp = INT8_MIN, > +.roi = pic->roi, > +.roi_flags.bits.roi_value_is_qp_delta = 1, > +}; > + > +err = vaapi_encode_make_misc_param_buffer(avctx, pic, > + > VAEncMiscParameterTypeROI, > + _roi, > + > sizeof(param_roi)); > +if (err < 0) > +goto fail; > +} > +#endif > + > vas = vaBeginPicture(ctx->hwctx->display, ctx->va_context, > pic->input_surface); > if (vas != VA_STATUS_SUCCESS) { > @@ -500,6 +566,7 @@ fail_at_end: > av_freep(>codec_picture_params); > av_freep(>param_buffers); > av_freep(>slices); > +av_freep(>roi); > av_frame_free(>recon_image); > av_buffer_unref(>output_buffer_ref); > pic->output_buffer = VA_INVALID_ID; > @@ -634,6 +701,7 @@ static int vaapi_encode_free(AVCodecContext *avctx, > > av_freep(>priv_data); > av_freep(>codec_picture_params); > +av_freep(>roi); > > av_free(pic); > > @@ -948,6 +1016,19 @@ static int > vaapi_encode_check_frame(AVCodecContext *avctx, > ctx->crop_warned = 1; > } > > +if (!ctx->roi_allowed) { > +AVFrameSideData *sd = > +av_frame_get_side_data(frame, > AV_FRAME_DATA_REGIONS_OF_INTEREST); > + > +if (sd && !ctx->roi_warned) { > +if (sd && !ctx->roi_warned) { looks good except this duplicate code > +av_log(avctx, AV_LOG_WARNING, "ROI side data on input > " > + "frames ignored due to lack of driver > support.\n"); > +
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/fitsdec: Prevent division by 0 with huge data_max
On 16.07.2019, at 00:50, Michael Niedermayer wrote: > Fixes: division by 0 > Fixes: > 15657/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5738154838982656 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/fitsdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c > index 4f452422ef..fe941f199d 100644 > --- a/libavcodec/fitsdec.c > +++ b/libavcodec/fitsdec.c > @@ -174,7 +174,7 @@ static int fits_read_header(AVCodecContext *avctx, const > uint8_t **ptr, FITSHead > return AVERROR_INVALIDDATA; > } > av_log(avctx, AV_LOG_WARNING, "data min/max indicates a blank > image\n"); > -header->data_max ++; > +header->data_max += fabs(header->data_max) / 1000 + 1; This is really non-obvious, both by itself, in where/how it causes the division by 0 and that the error here isn't worse than the division by 0 for example, and why this constant was chosen. Also why a division and not a multiply by the inverse? Why not * (1.0f / (1 << 24)) for example, which for single-precision IEEE I think should result in exactly 1 ULP (well, possibly 2 with rounding) increments? Why is this even using floating-point? And why not double-precision at least? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/sanm: Check extradata_size before allocations
On 16.07.2019, at 00:50, Michael Niedermayer wrote: > Fixes: Leaks > Fixes: > 15349/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5102530557640704 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/sanm.c | 9 - > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c > index 25aee7220f..60e2f4c624 100644 > --- a/libavcodec/sanm.c > +++ b/libavcodec/sanm.c > @@ -491,6 +491,10 @@ static av_cold int decode_init(AVCodecContext *avctx) > > ctx->avctx = avctx; > ctx->version = !avctx->extradata_size; > +if (!ctx->version && avctx->extradata_size < 1026) { > +av_log(avctx, AV_LOG_ERROR, "Not enough extradata.\n"); > +return AVERROR_INVALIDDATA; > +} > > avctx->pix_fmt = ctx->version ? AV_PIX_FMT_RGB565 : AV_PIX_FMT_PAL8; > > @@ -506,11 +510,6 @@ static av_cold int decode_init(AVCodecContext *avctx) > if (!ctx->version) { > int i; > > -if (avctx->extradata_size < 1026) { > -av_log(avctx, AV_LOG_ERROR, "Not enough extradata.\n"); > -return AVERROR_INVALIDDATA; > -} This seems quite a bit less obvious. Is that the only error return case, and is adding the cleanup code complex enough that this is the better choice? Either way I'd recommend a comment like // early sanity check before allocations to avoid need for deallocation code. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] how to create sub project / git repo under FFMPEG
Hi Michael, With the development of ffmpeg dnn module, there is a need to get a git repo, controlled by FFMPEG, to hold dnn materials, such as training scripts, trained parameters etc, as discussed at http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245750.html. Could you please let me know how to create a sub project / git repo under FFMPEG? thanks. Best Regards, Yejun ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/4] dnn: convert tf.pad to native model in python script, and load/execute it in the c code.
since tf.pad is enabled, the conv2d(valid) changes back to its original behavior. Signed-off-by: Guo, Yejun --- libavfilter/dnn/dnn_backend_native.c| 35 + libavfilter/dnn/dnn_backend_native.h| 2 +- tools/python/convert_from_tensorflow.py | 23 +- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index 82e900b..09c583b 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -25,6 +25,7 @@ #include "dnn_backend_native.h" #include "libavutil/avassert.h" +#include "dnn_backend_native_layer_pad.h" static DNNReturnType set_input_output_native(void *model, DNNInputData *input, const char *input_name, const char **output_names, uint32_t nb_output) { @@ -32,6 +33,7 @@ static DNNReturnType set_input_output_native(void *model, DNNInputData *input, c InputParams *input_params; ConvolutionalParams *conv_params; DepthToSpaceParams *depth_to_space_params; +LayerPadParams *pad_params; int cur_width, cur_height, cur_channels; int32_t layer; @@ -77,6 +79,12 @@ static DNNReturnType set_input_output_native(void *model, DNNInputData *input, c cur_height *= depth_to_space_params->block_size; cur_width *= depth_to_space_params->block_size; break; +case MIRROR_PAD: +pad_params = (LayerPadParams *)network->layers[layer].params; +cur_height = cur_height + pad_params->paddings[1][0] + pad_params->paddings[1][1]; +cur_width = cur_width + pad_params->paddings[2][0] + pad_params->paddings[2][1]; +cur_channels = cur_channels + pad_params->paddings[3][0] + pad_params->paddings[3][1]; +break; default: return DNN_ERROR; } @@ -110,6 +118,7 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename) DNNLayerType layer_type; ConvolutionalParams *conv_params; DepthToSpaceParams *depth_to_space_params; +LayerPadParams *pad_params; model = av_malloc(sizeof(DNNModel)); if (!model){ @@ -207,6 +216,23 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename) network->layers[layer].type = DEPTH_TO_SPACE; network->layers[layer].params = depth_to_space_params; break; +case MIRROR_PAD: +pad_params = av_malloc(sizeof(LayerPadParams)); +if (!pad_params){ +avio_closep(_file_context); +ff_dnn_free_model_native(); +return NULL; +} +pad_params->mode = (int32_t)avio_rl32(model_file_context); +dnn_size += 4; +for (i = 0; i < 4; ++i) { +pad_params->paddings[i][0] = avio_rl32(model_file_context); +pad_params->paddings[i][1] = avio_rl32(model_file_context); +dnn_size += 8; +} +network->layers[layer].type = MIRROR_PAD; +network->layers[layer].params = pad_params; +break; default: avio_closep(_file_context); ff_dnn_free_model_native(); @@ -314,6 +340,7 @@ DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, DNNData *output InputParams *input_params; ConvolutionalParams *conv_params; DepthToSpaceParams *depth_to_space_params; +LayerPadParams *pad_params; if (network->layers_num <= 0 || network->layers[0].type != INPUT || !network->layers[0].output){ return DNN_ERROR; @@ -348,6 +375,14 @@ DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, DNNData *output cur_width *= depth_to_space_params->block_size; cur_channels /= depth_to_space_params->block_size * depth_to_space_params->block_size; break; +case MIRROR_PAD: +pad_params = (LayerPadParams *)network->layers[layer].params; +dnn_execute_layer_pad(network->layers[layer - 1].output, network->layers[layer].output, + pad_params, 1, cur_height, cur_width, cur_channels); +cur_height = cur_height + pad_params->paddings[1][0] + pad_params->paddings[1][1]; +cur_width = cur_width + pad_params->paddings[2][0] + pad_params->paddings[2][1]; +cur_channels = cur_channels + pad_params->paddings[3][0] + pad_params->paddings[3][1]; +break; case INPUT: return DNN_ERROR; } diff --git a/libavfilter/dnn/dnn_backend_native.h b/libavfilter/dnn/dnn_backend_native.h index 532103c..c615d59 100644 --- a/libavfilter/dnn/dnn_backend_native.h +++ b/libavfilter/dnn/dnn_backend_native.h @@ -30,7 +30,7 @@ #include "../dnn_interface.h" #include "libavformat/avio.h" -typedef enum {INPUT, CONV, DEPTH_TO_SPACE} DNNLayerType; +typedef enum {INPUT, CONV, DEPTH_TO_SPACE, MIRROR_PAD}