Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: set DataRateLimits for hevc
> On Apr 25, 2021, at 11:31 PM, Rick Kern wrote: > > On Sun, Apr 25, 2021 at 4:06 AM Zhao Zhili wrote: > >> From the comment it's not available on old version. It works now >> by testing on macOS 11.2.1. There is no document about since when. >> So trying to set the configuration and ignore the error for hevc. >> --- >> libavcodec/videotoolboxenc.c | 10 +++--- >> 1 file changed, 7 insertions(+), 3 deletions(-) >> >> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c >> index 9b7ee6720c..cefd70fa88 100644 >> --- a/libavcodec/videotoolboxenc.c >> +++ b/libavcodec/videotoolboxenc.c >> @@ -1113,8 +1113,8 @@ static int vtenc_create_encoder(AVCodecContext >> *avctx, >> return AVERROR_EXTERNAL; >> } >> >> -if (vtctx->codec_id == AV_CODEC_ID_H264 && max_rate > 0) { >> -// kVTCompressionPropertyKey_DataRateLimits is not available for >> HEVC >> +if ((vtctx->codec_id == AV_CODEC_ID_H264 || vtctx->codec_id == >> AV_CODEC_ID_HEVC) >> +&& max_rate > 0) { >> bytes_per_second_value = max_rate >> 3; >> bytes_per_second = CFNumberCreate(kCFAllocatorDefault, >> kCFNumberSInt64Type, >> @@ -1152,7 +1152,11 @@ static int vtenc_create_encoder(AVCodecContext >> *avctx, >> >> if (status) { >> av_log(avctx, AV_LOG_ERROR, "Error setting max bitrate >> property: %d\n", status); >> -return AVERROR_EXTERNAL; >> +// kVTCompressionPropertyKey_DataRateLimits is available for >> HEVC >> +// now but not on old release. There is no document about >> since >> +// when. So ignore the error if it failed for hevc. >> +if (vtctx->codec_id != AV_CODEC_ID_HEVC) >> +return AVERROR_EXTERNAL; >> > The failure should be logged. Looks good otherwise. Yes and the failure is already logged just above the comments after `if (status)`. > > } >> } >> >> -- >> 2.31.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 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] [PATCH v2] lavfi/dnn/safe_queue.h: Add Documentation to SafeQueue
Documentation for SafeQueue Signed-off-by: Shubhanshu Saxena --- libavfilter/dnn/safe_queue.h | 60 1 file changed, 60 insertions(+) diff --git a/libavfilter/dnn/safe_queue.h b/libavfilter/dnn/safe_queue.h index 36d6daabaf..577a02e24d 100644 --- a/libavfilter/dnn/safe_queue.h +++ b/libavfilter/dnn/safe_queue.h @@ -21,16 +21,76 @@ #ifndef AVFILTER_DNN_SAFE_QUEUE_H #define AVFILTER_DNN_SAFE_QUEUE_H +/** + * Double-ended queue with mutex locks ensuring + * data consistency while multithreading. + */ typedef struct SafeQueue SafeQueue; +/** + * @brief Create and initialize a SafeQueue instance. + * + * @return Pointer to the SafeQueue + * @retval NULL if initialization fails + */ SafeQueue *ff_safe_queue_create(void); + +/** + * @brief Destroy the SafeQueue instance. + * It also frees all elements of the queue, + * destroys the mutex and condition variable. + */ void ff_safe_queue_destroy(SafeQueue *sq); +/** + * @brief Return the length of the SafeQueue + */ size_t ff_safe_queue_size(SafeQueue *sq); +/** + * @brief Add data to the head of queue in the + * SafeQueue after locking mutex. After adding + * the data, it signals the condition variable + * and unlocks the mutex. It increases the length + * of queue in the SafeQueue by one. + * + * @param sq pointer to the SafeQueue + * @param v data to be added + * @return The length of the queue + * @retval 0 if the queue is not initialized + * @retval -1 if new entry cannot be created + */ int ff_safe_queue_push_front(SafeQueue *sq, void *v); + +/** + * @brief Add data to the tail of queue in the + * SafeQueue after locking mutex. After adding + * the data, it signals the condition variable + * and unlocks the mutex. It increases the length + * of queue in the SafeQueue by one. + * + * @param sq pointer to the SafeQueue + * @param v data to be added + * @return The length of the queue + * @retval 0 if the queue is not initialized + * @retval -1 if new entry cannot be created + */ int ff_safe_queue_push_back(SafeQueue *sq, void *v); +/** + * @brief Remove and free first element from + * the queue in SafeQueue. Before removing, it + * waits for the condition variable to signal and + * acquires the mutex. Finally, it signals the + * condition and unlocks the mutex. + * It shrinks the length of queue in the SafeQueue + * by one. + * + * @param sq pointer to the SafeQueue. + * @return The value of first element as void. + * If a null pointer or empty queue is passed, + * it returns NULL + */ void *ff_safe_queue_pop_front(SafeQueue *sq); #endif -- 2.27.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 v2] lavfi/dnn/queue.h: Add Documentation to Queue
Documentation for Queue Signed-off-by: Shubhanshu Saxena --- libavfilter/dnn/queue.h | 75 + 1 file changed, 75 insertions(+) diff --git a/libavfilter/dnn/queue.h b/libavfilter/dnn/queue.h index 4d7121366a..2524d5fa59 100644 --- a/libavfilter/dnn/queue.h +++ b/libavfilter/dnn/queue.h @@ -22,20 +22,95 @@ #ifndef AVFILTER_DNN_QUEUE_H #define AVFILTER_DNN_QUEUE_H +/** + * Linear double-ended data structure + */ typedef struct Queue Queue; +/** + * @brief Create a Queue instance. + * It initializes the length of the Queue as 0. + * + * @return Pointer to the Queue + * @retval NULL if allocation fails + */ Queue *ff_queue_create(void); + +/** + * @brief Destroy the Queue instance. + * It also frees all elements of the Queue. + */ void ff_queue_destroy(Queue *q); +/** + * @brief Return the length of the Queue + */ size_t ff_queue_size(Queue *q); +/** + * @brief Return a pointer to the data + * at the head of the queue. + * + * @retval NULL if null pointer was passed + * or queue is empty + */ void *ff_queue_peek_front(Queue *q); + +/** + * @brief Return a pointer to the data at + * the tail of the queue. + * + * @retval NULL if null pointer was passed + * or queue is empty + */ void *ff_queue_peek_back(Queue *q); +/** + * @brief Add data to the head of the queue. + * It increases the length of Queue by one. + * + * @param q pointer to the Queue. + * @param v data to be added + * @return The length of the Queue + * @retval 0 if the pointer to queue is NULL + * @retval -1 if new entry cannot be created + */ int ff_queue_push_front(Queue *q, void *v); + +/** + * @brief Add data to the tail of the queue. + * It increases the length of Queue by one. + * + * @param q pointer to the Queue + * @param v data to be added + * @return The length of the Queue + * @retval 0 if the pointer to queue is NULL + * @retval -1 if new entry cannot be created + */ int ff_queue_push_back(Queue *q, void *v); +/** + * @brief Remove and free first element from + * the Queue. It shrinks the length of Queue + * by one. + * + * @param q pointer to the Queue. + * @return The value of first element as void. + * If a null pointer or empty queue is passed, + * it returns NULL + */ void *ff_queue_pop_front(Queue *q); + +/** + * @brief Remove and free last element from + * the Queue. It shrinks the length of Queue + * by one. + * + * @param q pointer to the Queue. + * @return The value of last element as void. + * If a null pointer or empty queue is passed, + * it returns NULL + */ void *ff_queue_pop_back(Queue *q); #endif -- 2.27.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] libavfilter: Add Documentation to SafeQueue
Okay, I have sent the v2 patches for both. On Mon, Apr 26, 2021 at 7:52 AM Guo, Yejun wrote: > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > Shubhanshu Saxena > > Sent: 2021年4月25日 21:19 > > To: ffmpeg-devel@ffmpeg.org > > Cc: shubhanshu02 > > Subject: [FFmpeg-devel] [PATCH] libavfilter: Add Documentation to > > SafeQueue > > > > From: shubhanshu02 > > > > Adds documentation to queue.h in libavfilter/dnn > > > > Signed-off-by: shubhanshu02 > > --- > > libavfilter/dnn/safe_queue.h | 60 > > > > 1 file changed, 60 insertions(+) > > > > diff --git a/libavfilter/dnn/safe_queue.h b/libavfilter/dnn/safe_queue.h > > index 36d6daabaf..577a02e24d 100644 > > --- a/libavfilter/dnn/safe_queue.h > > +++ b/libavfilter/dnn/safe_queue.h > > please change the commit title as below and send out v2 patch. > lavfi/dnn/safe_queue.h: Add Documentation to SafeQueue > > and the same change for the other patch for queue.h > ___ > 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 v5 3/3] avcodec/adpcm: Fixes output from Westwood ADPCM.
From: ffmpeg-devel on behalf of Zane van Iperen Sent: 26 April 2021 01:46 To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH v5 3/3] avcodec/adpcm: Fixes output from Westwood ADPCM. On 26/4/21 6:00 am, Aidan Richmond wrote: Patch 1/3: lgtm Patch 2/3: > +static int wsaud_write_init(AVFormatContext *ctx) > +{ > +AVStream *st = ctx->streams[0]; > +AVIOContext *pb = ctx->pb; > + > +/* Stream must be seekable to correctly write the file. */ > +if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) { > +av_log(ctx->streams[0], AV_LOG_ERROR, "Cannot write Westwood aud to" > + " none seekable stream.\n"); > +return AVERROR(EINVAL); > +} > + Typo, Non-seekable? And capitalise aud -> AUD to be consistent. Patch 3/3: > Fixes bug #9198 > > Signed-off-by: Aidan Richmond > --- > libavcodec/adpcm.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c > index be14607eac..5ec9691001 100644 > --- a/libavcodec/adpcm.c > +++ b/libavcodec/adpcm.c > @@ -1400,16 +1400,16 @@ static int adpcm_decode_frame(AVCodecContext *avctx, > void *data, > > for (n = nb_samples / 2; n > 0; n--) { > int v = bytestream2_get_byteu(&gb); > -*smp++ = adpcm_ima_expand_nibble(&c->status[channel], v > >> 4 , 3); > *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v > & 0x0F, 3); > +*smp++ = adpcm_ima_expand_nibble(&c->status[channel], v > >> 4 , 3); > } > } > } else { > for (n = nb_samples / 2; n > 0; n--) { > for (channel = 0; channel < avctx->channels; channel++) { > int v = bytestream2_get_byteu(&gb); > -*samples++ = > adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); > -samples[st] = > adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); > +*samples++ = > adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); > +samples[st] = > adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); > } > samples += avctx->channels; > } > As Andreas said in the previous patch, you need to update the FATE test. If it's easier (and with your permission), I can just do this and squash it into the commit before I apply it. Might as well fix the typo in 2/3 too. See https://github.com/vs49688/FFmpeg/commit/806f982ca2c310d6d639a3e554735b41b67c9259.patch ___ 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". If you don't mind doing the last bit to get it to a mergable state, I'm happy to give my permission. Thanks for all the feedback and the back and forth to work this into something mergeable, I really appreciate the patience and support. ___ 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] libavfilter: Add Documentation to SafeQueue
> -Original Message- > From: ffmpeg-devel On Behalf Of > Shubhanshu Saxena > Sent: 2021年4月26日 15:55 > To: FFmpeg development discussions and patches > > Subject: Re: [FFmpeg-devel] [PATCH] libavfilter: Add Documentation to > SafeQueue > > Okay, I have sent the v2 patches for both. thanks, and please avoid top-posting in mail, see more at https://ffmpeg.org/mailing-list-faq.html#What-is-top_002dposting_003f-1 > > On Mon, Apr 26, 2021 at 7:52 AM Guo, Yejun > wrote: > > > > > > > > -Original Message- > > > From: ffmpeg-devel On Behalf Of > > > Shubhanshu Saxena > > > Sent: 2021年4月25日 21:19 > > > To: ffmpeg-devel@ffmpeg.org > > > Cc: shubhanshu02 > > > Subject: [FFmpeg-devel] [PATCH] libavfilter: Add Documentation to > > > SafeQueue > > > > > > From: shubhanshu02 > > > > > > Adds documentation to queue.h in libavfilter/dnn > > > > > > Signed-off-by: shubhanshu02 > > > --- > > > libavfilter/dnn/safe_queue.h | 60 > > > > > > 1 file changed, 60 insertions(+) > > > > > > diff --git a/libavfilter/dnn/safe_queue.h b/libavfilter/dnn/safe_queue.h > > > index 36d6daabaf..577a02e24d 100644 > > > --- a/libavfilter/dnn/safe_queue.h > > > +++ b/libavfilter/dnn/safe_queue.h > > > > please change the commit title as below and send out v2 patch. > > lavfi/dnn/safe_queue.h: Add Documentation to SafeQueue > > > > and the same change for the other patch for queue.h > > ___ > > 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 05/12] fate-ts-small-demux: convert to ffprobe
On Sun, Apr 25, 2021 at 09:58:56PM +0200, Anton Khirnov wrote: > Quoting Michael Niedermayer (2021-04-25 21:28:42) > > On Sun, Apr 25, 2021 at 04:12:41PM +0200, Anton Khirnov wrote: > > > Quoting Michael Niedermayer (2021-04-25 11:29:56) > > > > On Sun, Apr 25, 2021 at 09:03:13AM +0200, Anton Khirnov wrote: > > > > > It can handle side data cleanly. > > > > [] > > > > > +stream|index=0|codec_name=h264|profile=578|codec_type=video|codec_tag_string=[27][0][0][0]|codec_tag=0x001b|width=82|height=144|coded_width=82|coded_height=144|closed_captions=0|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=41:72|pix_fmt=yuv420p|level=10|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|is_avc=false|nal_length_size=0|id=0x100|r_frame_rate=15/1|avg_frame_rate=15/1|time_base=1/9|start_pts=126000|start_time=1.40|duration_ts=444000|duration=4.93|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=74|extradata_hash=CRC32:e62cae27|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition: > timed_th > > > > > > > > > > umbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0 > > > > > +format|filename=h264small.ts|nb_streams=1|nb_programs=1|format_name=mpegts|start_time=1.40|duration=4.93|size=16544|bit_rate=26828|probe_score=50 > > > > > > > > It seems something is cuttning long lines > > > > > > The email arrives correctly when I send it directly to myself, so I > > > assume the ML is mangling things. Didn't something similar happen to > > > James recently? > > > > yes, is this a new issue with the servers mail setup or did we just not > > have so long lines previously ? > > > > the length seems truncated around 1000 and smtp_line_length_limit has a > > default of around that. RFC 5321 also doesnt allow longer lines so iam > > not sure if bumping that limit up is the correct thing to do (if its that > > what truncates it) > > > > Iam not a mail expert, but naively to me this looks like the > > sender should use base64 or some other encoding if a long line is > > encountered > > The original mail was sent as 'quoted-printable' with "soft" line breaks > ([1], section 6.7 (5)) with the actual "physical" lines in the file > wrapped to 76 characters as per RFC. > > The mail that arrived from the list was '7bit', where the line length is > indeed limited to 998 characters ([2], section 2.1.1). So it seems > likely that the code that adds the mailing list footer is responsible. > IMO it should be configured to always add the footer as a separate MIME > part rather than mangling the original message body (if it's possible). I dont see an option in the mailman web interface to change the way the footer is added. But i would be very happy if someone replies and tells me that i missed something or any other fix. I imagine FFmpeg is not the first or only project that hit this issue ... thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. 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] test sending very long lines to ML
--- sent as quoted-printable testfile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 testfile diff --git a/testfile b/testfile new file mode 100644 index 00..68bb7cbf9c --- /dev/null +++ b/testfile @@ -0,0 +1,3 @@ +This is a test file with very long lines += = == +testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestt esttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestte sttesttesttesttesttesttesttesttesttesttesttesttesttest -- 2.30.2 ___ 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] test sending very long lines to ML
--- sent as base64 testfile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 testfile diff --git a/testfile b/testfile new file mode 100644 index 00..68bb7cbf9c --- /dev/null +++ b/testfile @@ -0,0 +1,3 @@ +This is a test file with very long lines += = == +testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestt esttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestte sttesttesttesttesttesttesttesttesttesttesttesttesttest -- 2.30.2 ___ 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] test sending very long lines to ML
>From a brief look at mailman source (src/mailman/handlers/decorate.py if anyone is interested), seems it will always mangle the original message body when it is a single-part text/plain. So sending as base64 does not help since mailman will recode it, as can be seen from the test emails I just sent. The actual bug might be in the python email library, which decides to use 7bit encoding even though it cannot represent very long lines. -- Anton Khirnov ___ 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 v3 4/4] avcodec/ttmlenc: add support for region positioning and sizing
From: Jan Ekström The ASS margins are utilized to generate percentual values, as the usage of cell-based sizing and offsetting seems to be not too well supported by renderers. Signed-off-by: Jan Ekström --- libavcodec/ttmlenc.c | 45 -- tests/ref/fate/sub-ttmlenc | 2 ++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/libavcodec/ttmlenc.c b/libavcodec/ttmlenc.c index 37372b29cd..6dfcc0a216 100644 --- a/libavcodec/ttmlenc.c +++ b/libavcodec/ttmlenc.c @@ -237,11 +237,35 @@ static const char *ttml_get_text_alignment(int alignment) } } +static void ttml_get_origin(ASSScriptInfo script_info, ASSStyle style, + int *origin_left, int *origin_top) +{ +*origin_left = av_rescale(style.margin_l, 100, script_info.play_res_x); +*origin_top = +av_rescale((style.alignment >= 7) ? style.margin_v : 0, + 100, script_info.play_res_y); +} + +static void ttml_get_extent(ASSScriptInfo script_info, ASSStyle style, + int *width, int *height) +{ +*width = av_rescale(script_info.play_res_x - style.margin_r, + 100, script_info.play_res_x); +*height = av_rescale((style.alignment <= 3) ? + script_info.play_res_y - style.margin_v : + script_info.play_res_y, + 100, script_info.play_res_y); +} + static int ttml_write_region(AVCodecContext *avctx, AVBPrint *buf, - ASSStyle style) + ASSScriptInfo script_info, ASSStyle style) { const char *display_alignment = NULL; const char *text_alignment = NULL; +int origin_left = 0; +int origin_top = 0; +int width = 0; +int height = 0; if (!style.name) { av_log(avctx, AV_LOG_ERROR, "Subtitle style name not set!\n"); @@ -254,6 +278,14 @@ static int ttml_write_region(AVCodecContext *avctx, AVBPrint *buf, return AVERROR_INVALIDDATA; } +if (style.margin_l < 0 || style.margin_r < 0 || style.margin_v < 0) { +av_log(avctx, AV_LOG_ERROR, + "One or more negative margin values in subtitle style: " + "left: %d, right: %d, vertical: %d!\n", + style.margin_l, style.margin_r, style.margin_v); +return AVERROR_INVALIDDATA; +} + display_alignment = ttml_get_display_alignment(style.alignment); text_alignment = ttml_get_text_alignment(style.alignment); if (!display_alignment || !text_alignment) { @@ -265,11 +297,19 @@ static int ttml_write_region(AVCodecContext *avctx, AVBPrint *buf, return AVERROR_INVALIDDATA; } +ttml_get_origin(script_info, style, &origin_left, &origin_top); +ttml_get_extent(script_info, style, &width, &height); + av_bprintf(buf, " buffer, "\n"); for (int i = 0; i < ass->styles_count; i++) { -int ret = ttml_write_region(avctx, &s->buffer, ass->styles[i]); +int ret = ttml_write_region(avctx, &s->buffer, script_info, +ass->styles[i]); if (ret < 0) return ret; } diff --git a/tests/ref/fate/sub-ttmlenc b/tests/ref/fate/sub-ttmlenc index 6d0a8067fc..4df8f8796f 100644 --- a/tests/ref/fate/sub-ttmlenc +++ b/tests/ref/fate/sub-ttmlenc @@ -9,6 +9,8 @@ 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 v3 1/4] avcodec/ttmlenc: split header writing into its own function
From: Jan Ekström Signed-off-by: Jan Ekström --- libavcodec/ttmlenc.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/libavcodec/ttmlenc.c b/libavcodec/ttmlenc.c index 3972b4368c..e3c155fdd1 100644 --- a/libavcodec/ttmlenc.c +++ b/libavcodec/ttmlenc.c @@ -173,16 +173,8 @@ static av_cold int ttml_encode_close(AVCodecContext *avctx) return 0; } -static av_cold int ttml_encode_init(AVCodecContext *avctx) +static int ttml_write_header_content(AVCodecContext *avctx) { -TTMLContext *s = avctx->priv_data; - -s->avctx = avctx; - -if (!(s->ass_ctx = ff_ass_split(avctx->subtitle_header))) { -return AVERROR_INVALIDDATA; -} - if (!(avctx->extradata = av_mallocz(TTMLENC_EXTRADATA_SIGNATURE_SIZE + 1 + AV_INPUT_BUFFER_PADDING_SIZE))) { return AVERROR(ENOMEM); @@ -192,8 +184,25 @@ static av_cold int ttml_encode_init(AVCodecContext *avctx) memcpy(avctx->extradata, TTMLENC_EXTRADATA_SIGNATURE, TTMLENC_EXTRADATA_SIGNATURE_SIZE); +return 0; +} + +static av_cold int ttml_encode_init(AVCodecContext *avctx) +{ +TTMLContext *s = avctx->priv_data; +int ret = AVERROR_BUG; +s->avctx = avctx; + av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED); +if (!(s->ass_ctx = ff_ass_split(avctx->subtitle_header))) { +return AVERROR_INVALIDDATA; +} + +if ((ret = ttml_write_header_content(avctx)) < 0) { +return ret; +} + return 0; } -- 2.30.2 ___ 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 v3 3/4] avcodec/ttmlenc: add initial support for regions and styles
From: Jan Ekström Attempts to utilize the TTML cell resolution as a mapping to the reference resolution, and maps font size to cell size. Additionally sets the display and text alignment according to the ASS alignment number. Signed-off-by: Jan Ekström --- libavcodec/ttmlenc.c | 206 ++--- libavcodec/ttmlenc.h | 3 +- tests/ref/fate/sub-ttmlenc | 86 +--- 3 files changed, 243 insertions(+), 52 deletions(-) diff --git a/libavcodec/ttmlenc.c b/libavcodec/ttmlenc.c index e3c155fdd1..37372b29cd 100644 --- a/libavcodec/ttmlenc.c +++ b/libavcodec/ttmlenc.c @@ -100,20 +100,33 @@ static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf, dialog = ff_ass_split_dialog(s->ass_ctx, ass, 0, &num); for (; dialog && num--; dialog++) { -int ret = ff_ass_split_override_codes(&ttml_callbacks, s, - dialog->text); -int log_level = (ret != AVERROR_INVALIDDATA || - avctx->err_recognition & AV_EF_EXPLODE) ? -AV_LOG_ERROR : AV_LOG_WARNING; +if (dialog->style) { +av_bprintf(&s->buffer, "buffer, dialog->style, NULL, + AV_ESCAPE_MODE_XML, + AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES); +av_bprintf(&s->buffer, "\">"); +} -if (ret < 0) { -av_log(avctx, log_level, - "Splitting received ASS dialog failed: %s\n", - av_err2str(ret)); +{ +int ret = ff_ass_split_override_codes(&ttml_callbacks, s, + dialog->text); +int log_level = (ret != AVERROR_INVALIDDATA || + avctx->err_recognition & AV_EF_EXPLODE) ? +AV_LOG_ERROR : AV_LOG_WARNING; -if (log_level == AV_LOG_ERROR) -return ret; +if (ret < 0) { +av_log(avctx, log_level, + "Splitting received ASS dialog failed: %s\n", + av_err2str(ret)); + +if (log_level == AV_LOG_ERROR) +return ret; +} } + +if (dialog->style) +av_bprintf(&s->buffer, ""); } } else { #endif @@ -121,6 +134,14 @@ static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf, if (!dialog) return AVERROR(ENOMEM); +if (dialog->style) { +av_bprintf(&s->buffer, "buffer, dialog->style, NULL, + AV_ESCAPE_MODE_XML, + AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES); +av_bprintf(&s->buffer, "\">"); +} + { int ret = ff_ass_split_override_codes(&ttml_callbacks, s, dialog->text); @@ -140,6 +161,9 @@ static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf, } } +if (dialog->style) +av_bprintf(&s->buffer, ""); + ff_ass_free_dialog(&dialog); } #if FF_API_ASS_TIMING @@ -173,17 +197,171 @@ static av_cold int ttml_encode_close(AVCodecContext *avctx) return 0; } +static const char *ttml_get_display_alignment(int alignment) +{ +switch (alignment) { +case 1: +case 2: +case 3: +return "after"; +case 4: +case 5: +case 6: +return "center"; +case 7: +case 8: +case 9: +return "before"; +default: +return NULL; +} +} + +static const char *ttml_get_text_alignment(int alignment) +{ +switch (alignment) { +case 1: +case 4: +case 7: +return "left"; +case 2: +case 5: +case 8: +return "center"; +case 3: +case 6: +case 9: +return "right"; +default: +return NULL; +} +} + +static int ttml_write_region(AVCodecContext *avctx, AVBPrint *buf, + ASSStyle style) +{ +const char *display_alignment = NULL; +const char *text_alignment = NULL; + +if (!style.name) { +av_log(avctx, AV_LOG_ERROR, "Subtitle style name not set!\n"); +return AVERROR_INVALIDDATA; +} + +if (style.font_size < 0) { +av_log(avctx, AV_LOG_ERROR, "Invalid font size for TTML: %d!\n", + style.font_size); +return AVERROR_INVALIDDATA; +} + +display_alignment = ttml_get_display_alignment(style.alignment); +text_alignment = ttml_get_text_alignment(style.alignment); +
[FFmpeg-devel] [PATCH v3 0/4] Initial region (styling) support for TTML
Now sets alignment, font size, font family and the region's position and size according to the ASS styles passed to the encoder. Regions are relatively important in TTML, since the spec-defined default region is in raster location (similar to the default with HTML) - it starts from the top left corner and covers the whole screen. Mapping of the ASS script resolution to the cell resolution and using cells as sizing metric is not perfect, but while TTML does have a pixel based reference sizing by means of setting an extent to the root tt element, it is specifically disallowed in the EBU-TT profile, as well as apparently generally frowned upon as opposed to defining the cell resolution. In general, mapping to cell resolution seems to give "close enough" results, though. FATE test output still passes https://github.com/skynav/ttt/ validation, and visually the result can be verified against such renderers as http://sandflow.com/imsc1_1/index.html . Changes from v2: * Noticed that taking a pointer to an already dereferenced style in libavcodec/ttmlenc.c is unnecessary and complicates the style-writing function for no real reason. Thus, made the function just take in the struct, as opposed to a pointer to a struct. Will still be pushing this patch set in soon, posting this minor revision of the patch set just so that it is in the mailing list archives and patchwork's automation can poke at it. Jan Jan Ekström (4): avcodec/ttmlenc: split header writing into its own function avformat/ttmlenc: enable writing out additional header values avcodec/ttmlenc: add initial support for regions and styles avcodec/ttmlenc: add support for region positioning and sizing libavcodec/ttmlenc.c | 264 ++--- libavcodec/ttmlenc.h | 6 + libavformat/ttmlenc.c | 70 +- tests/ref/fate/sub-ttmlenc | 88 +++-- 4 files changed, 368 insertions(+), 60 deletions(-) -- 2.30.2 ___ 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 v3 2/4] avformat/ttmlenc: enable writing out additional header values
From: Jan Ekström This way the encoder may pass on the following values to the muxer: 1) Additional root "tt" element attributes, such as the subtitle canvas reference size. 2) Anything before the body element of the document, such as regions in the head element, which can configure styles. Signed-off-by: Jan Ekström --- libavcodec/ttmlenc.h | 5 libavformat/ttmlenc.c | 70 +++ 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/libavcodec/ttmlenc.h b/libavcodec/ttmlenc.h index c1dd5ec990..c3bb11478d 100644 --- a/libavcodec/ttmlenc.h +++ b/libavcodec/ttmlenc.h @@ -25,4 +25,9 @@ #define TTMLENC_EXTRADATA_SIGNATURE "lavc-ttmlenc" #define TTMLENC_EXTRADATA_SIGNATURE_SIZE (sizeof(TTMLENC_EXTRADATA_SIGNATURE) - 1) +static const char ttml_default_namespacing[] = +" xmlns=\"http://www.w3.org/ns/ttml\"\n"; +" xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\"\n"; +" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\"\n";; + #endif /* AVCODEC_TTMLENC_H */ diff --git a/libavformat/ttmlenc.c b/libavformat/ttmlenc.c index 940f8bbd4e..34a0107a14 100644 --- a/libavformat/ttmlenc.c +++ b/libavformat/ttmlenc.c @@ -37,6 +37,11 @@ enum TTMLPacketType { PACKET_TYPE_DOCUMENT, }; +struct TTMLHeaderParameters { +const char *tt_element_params; +const char *pre_body_elements; +}; + typedef struct TTMLMuxContext { enum TTMLPacketType input_type; unsigned int document_written; @@ -45,10 +50,9 @@ typedef struct TTMLMuxContext { static const char ttml_header_text[] = "\n" "http://www.w3.org/ns/ttml\"\n"; -" xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\"\n"; -" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\"\n"; +"%s" " xml:lang=\"%s\">\n" +"%s" " \n" "\n"; @@ -72,6 +76,48 @@ static void ttml_write_time(AVIOContext *pb, const char tag[], tag, hour, min, sec, millisec); } +static int ttml_set_header_values_from_extradata( +AVCodecParameters *par, struct TTMLHeaderParameters *header_params) +{ +size_t additional_data_size = +par->extradata_size - TTMLENC_EXTRADATA_SIGNATURE_SIZE; +char *value = +(char *)par->extradata + TTMLENC_EXTRADATA_SIGNATURE_SIZE; +size_t value_size = av_strnlen(value, additional_data_size); +struct TTMLHeaderParameters local_params = { 0 }; + +if (!additional_data_size) { +// simple case, we don't have to go through local_params and just +// set default fall-back values (for old extradata format). +header_params->tt_element_params = ttml_default_namespacing; +header_params->pre_body_elements = ""; + +return 0; +} + +if (value_size == additional_data_size || +value[value_size] != '\0') +return AVERROR_INVALIDDATA; + +local_params.tt_element_params = value; + +additional_data_size -= value_size + 1; +value += value_size + 1; +if (!additional_data_size) +return AVERROR_INVALIDDATA; + +value_size = av_strnlen(value, additional_data_size); +if (value_size == additional_data_size || +value[value_size] != '\0') +return AVERROR_INVALIDDATA; + +local_params.pre_body_elements = value; + +*header_params = local_params; + +return 0; +} + static int ttml_write_header(AVFormatContext *ctx) { TTMLMuxContext *ttml_ctx = ctx->priv_data; @@ -103,8 +149,22 @@ static int ttml_write_header(AVFormatContext *ctx) avpriv_set_pts_info(st, 64, 1, 1000); -if (ttml_ctx->input_type == PACKET_TYPE_PARAGRAPH) -avio_printf(pb, ttml_header_text, printed_lang); +if (ttml_ctx->input_type == PACKET_TYPE_PARAGRAPH) { +struct TTMLHeaderParameters header_params; +int ret = ttml_set_header_values_from_extradata( +st->codecpar, &header_params); +if (ret < 0) { +av_log(ctx, AV_LOG_ERROR, + "Failed to parse TTML header values from extradata: " + "%s!\n", av_err2str(ret)); +return ret; +} + +avio_printf(pb, ttml_header_text, +header_params.tt_element_params, +printed_lang, +header_params.pre_body_elements); +} } return 0; -- 2.30.2 ___ 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 1/6] doc/filters: correct http link
From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 67587d9..e99d70a 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -9886,7 +9886,7 @@ Native implementation of DNN loading and execution. @item tensorflow TensorFlow backend. To enable this backend you need to install the TensorFlow for C library (see -@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with +@url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with @code{--enable-libtensorflow} @end table Default value is @samp{native}. @@ -10187,7 +10187,7 @@ Native implementation of DNN loading and execution. @item tensorflow TensorFlow backend. To enable this backend you need to install the TensorFlow for C library (see -@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with +@url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with @code{--enable-libtensorflow} @item openvino @@ -18893,7 +18893,7 @@ Native implementation of DNN loading and execution. @item tensorflow TensorFlow backend. To enable this backend you need to install the TensorFlow for C library (see -@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with +@url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with @code{--enable-libtensorflow} @end table -- 1.8.3.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 2/6] avfilter/vf_sr: add options for backend configs
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/vf_sr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index 45f941a..282c468 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -55,6 +55,8 @@ static const AVOption sr_options[] = { { "model", "path to model file specifying network architecture and its parameters", OFFSET(dnnctx.model_filename), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, { "input", "input name of the model", OFFSET(dnnctx.model_inputname), AV_OPT_TYPE_STRING,{ .str = "x" }, 0, 0, FLAGS }, { "output", "output name of the model", OFFSET(dnnctx.model_outputname), AV_OPT_TYPE_STRING,{ .str = "y" }, 0, 0, FLAGS }, +{ "backend_configs","backend configs", OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = NULL }, 0, 0, FLAGS }, +{ "options","backend configs", OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = NULL }, 0, 0, FLAGS }, { NULL } }; -- 1.8.3.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 3/6] doc/filters: documentation to options for backend
From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 9 + 1 file changed, 9 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index e99d70a..a959127 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10159,6 +10159,7 @@ and the second line is the name of label id 1, etc. The label id is considered as name if the label file is not provided. @item backend_configs +@item options Set the configs to be passed into backend @item async @@ -10214,6 +10215,10 @@ Set the input name of the dnn network. @item output Set the output name of the dnn network. +@item backend_configs +@item options +Set the configs to be passed into backend + @item async use DNN async execution if set (default: set), roll back to sync execution if the backend does not support async. @@ -18905,6 +18910,10 @@ Note that different backends use different file formats. TensorFlow backend can load files for both formats, while native backend can load files for only its format. +@item backend_configs +@item options +Set the configs to be passed into backend + @item scale_factor Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts -- 1.8.3.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 4/6] tools/python: add help script to get sess_config
From: Limin Wang Please note the byte order of the hex data is in normal order. Signed-off-by: Limin Wang --- tools/python/tf_sess_config.py | 44 ++ 1 file changed, 44 insertions(+) create mode 100644 tools/python/tf_sess_config.py diff --git a/tools/python/tf_sess_config.py b/tools/python/tf_sess_config.py new file mode 100644 index 000..e4e38bd --- /dev/null +++ b/tools/python/tf_sess_config.py @@ -0,0 +1,44 @@ +# Copyright (c) 2021 +# +# 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 +# == + +# verified with Python 3.6.8 on CentOS 7.2 +import tensorflow as tf + +visible_device_list = '0' # use , separator for more GPUs like '0, 1' +per_process_gpu_memory_fraction = 0.9 # avoid out of memory +intra_op_parallelism_threads = 2 # default in tensorflow +inter_op_parallelism_threads = 5 # default in tensorflow + +gpu_options = tf.compat.v1.GPUOptions( + per_process_gpu_memory_fraction = per_process_gpu_memory_fraction, + visible_device_list = visible_device_list, + allow_growth = True) + +config = tf.compat.v1.ConfigProto( + allow_soft_placement = True, + log_device_placement = False, + intra_op_parallelism_threads = intra_op_parallelism_threads, + inter_op_parallelism_threads = inter_op_parallelism_threads, + gpu_options = gpu_options) + +s = config.SerializeToString() +# print(list(map(hex, s))) # print by json if need + +b = ''.join(format(b,'02x') for b in s) +print('0x%s' % b) # print by hex format -- 1.8.3.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 5/6] avfilter/dnn/dnn_backend_tf: simplify the code with ff_hex_to_data
From: Limin Wang please use tools/python/tf_sess_config.py to get the sess_config after that. note the byte order of session config is the normal order. Signed-off-by: Limin Wang --- libavfilter/dnn/dnn_backend_tf.c | 34 ++ 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index fb799d2..0084157 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -28,6 +28,7 @@ #include "dnn_backend_native_layer_conv2d.h" #include "dnn_backend_native_layer_depth2space.h" #include "libavformat/avio.h" +#include "libavformat/internal.h" #include "libavutil/avassert.h" #include "../internal.h" #include "dnn_backend_native_layer_pad.h" @@ -202,35 +203,21 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename TF_SessionOptions *sess_opts; const TF_Operation *init_op; uint8_t *sess_config = NULL; -int sess_config_length = 0; +int sess_config_length = ff_hex_to_data(NULL, tf_model->ctx.options.sess_config + 2); // prepare the sess config data if (tf_model->ctx.options.sess_config != NULL) { /* tf_model->ctx.options.sess_config is hex to present the serialized proto required by TF_SetConfig below, so we need to first generate the serialized -proto in a python script, the following is a script example to generate -serialized proto which specifies one GPU, we can change the script to add -more options. - -import tensorflow as tf -gpu_options = tf.GPUOptions(visible_device_list='0') -config = tf.ConfigProto(gpu_options=gpu_options) -s = config.SerializeToString() -b = ''.join("%02x" % int(ord(b)) for b in s[::-1]) -print('0x%s' % b) - -the script output looks like: 0xab...cd, and then pass 0xab...cd to sess_config. +proto in a python script, tools/python/tf_sess_config.py is a script example +to generate the configs of sess_config. */ -char tmp[3]; -tmp[2] = '\0'; - if (strncmp(tf_model->ctx.options.sess_config, "0x", 2) != 0) { av_log(ctx, AV_LOG_ERROR, "sess_config should start with '0x'\n"); return DNN_ERROR; } -sess_config_length = strlen(tf_model->ctx.options.sess_config); if (sess_config_length % 2 != 0) { av_log(ctx, AV_LOG_ERROR, "the length of sess_config is not even (%s), " "please re-generate the config.\n", @@ -238,21 +225,12 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename return DNN_ERROR; } -sess_config_length -= 2; //ignore the first '0x' -sess_config_length /= 2; //get the data length in byte - -sess_config = av_malloc(sess_config_length); +sess_config = av_mallocz(sess_config_length + AV_INPUT_BUFFER_PADDING_SIZE); if (!sess_config) { av_log(ctx, AV_LOG_ERROR, "failed to allocate memory\n"); return DNN_ERROR; } - -for (int i = 0; i < sess_config_length; i++) { -int index = 2 + (sess_config_length - 1 - i) * 2; -tmp[0] = tf_model->ctx.options.sess_config[index]; -tmp[1] = tf_model->ctx.options.sess_config[index + 1]; -sess_config[i] = strtol(tmp, NULL, 16); -} +ff_hex_to_data(sess_config, tf_model->ctx.options.sess_config + 2); } graph_def = read_graph(model_filename); -- 1.8.3.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".
Re: [FFmpeg-devel] [PATCH] avpacket: ABI bump additions
Apr 26, 2021, 02:36 by c...@passwd.hu: > > > On Sun, 25 Apr 2021, Lynne wrote: > >> This is the same patch sent in January, rebased on top of the ABI bump >> patchset. >> >> Two additions mirror exactly what AVFrame has - an opaque field >> and an opaque_ref for user-side private data. >> For justification on the void *opaque field, you can read the archives, >> since the question was brought up in January. >> >> As for the time_base field, for now, it will only be used to inform the user, >> and will not alter the behavior of the libraries. That change will come as an >> optional flag. >> > > I would like to see some documentation and code which shows when the > time_base is respected and when it is not before it is added to AVPacket. > After the bump we usually have a 1-2 months of cooldown when the ABI can > change, so there really is no rush. > I didn't mean to say that it'll be done during the bump, but rather after it. Once we add time_base, there are no ABI-breaking changes to support what I was thinking of. Or do you still want to see some code? It's not a small amount of work. ___ 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 6/6] doc/filters: Documentation to add sess_config option for tensorflow backend
From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index a959127..1ee4354 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10162,6 +10162,9 @@ The label id is considered as name if the label file is not provided. @item options Set the configs to be passed into backend +For tensorflow backend, you can set its configs with @option{sess_config} options, +please use tools/python/tf_sess_config.py to get the configs + @item async use DNN async execution if set (default: set), roll back to sync execution if the backend does not support async. @@ -10219,6 +10222,9 @@ Set the output name of the dnn network. @item options Set the configs to be passed into backend +For tensorflow backend, you can set its configs with @option{sess_config} options, +please use tools/python/tf_sess_config.py to get the configs + @item async use DNN async execution if set (default: set), roll back to sync execution if the backend does not support async. @@ -10247,9 +10253,10 @@ Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p @end example @item -Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported): +Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported), please +use tools/python/tf_sess_config.py to get the configs for your system. @example -./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg +./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y:options=sess_config=0x10022805320e09cdccec3f20012a01303801 -y tmp.espcn.jpg @end example @end itemize @@ -18914,6 +18921,9 @@ its format. @item options Set the configs to be passed into backend +For tensorflow backend, you can set its configs with @option{sess_config} options, +please use tools/python/tf_sess_config.py to get the configs. + @item scale_factor Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts -- 1.8.3.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] avformat/adtsenc: clarify option help
Also remove unnecessary unit as option does not accept any constants. --- libavformat/adtsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index ae1b1b364c..19262784ce 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -216,7 +216,7 @@ static int adts_write_trailer(AVFormatContext *s) static const AVOption options[] = { { "write_id3v2", "Enable ID3v2 tag writing", OFFSET(id3v2tag), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, ENC}, { "write_apetag", "Enable APE tag writing", OFFSET(apetag), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, ENC}, -{ "write_mpeg2", "Use MPE2 ID when writing", OFFSET(mpeg_id), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, ENC, "mpeg_id"}, +{ "write_mpeg2", "Set MPEG version to MPEG-2", OFFSET(mpeg_id), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, ENC}, { NULL }, }; -- 2.30.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".
Re: [FFmpeg-devel] [PATCH 01/12] ffprobe: only hash extradata when it is present
Anton Khirnov: > Passing zero-sized/NULL buffers to av_hash_update() is invalid and may > crash with certain hashes. > --- > fftools/ffprobe.c | 7 +-- > tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 - > tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 - > 3 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c > index a2cb7dc986..9039985dcb 100644 > --- a/fftools/ffprobe.c > +++ b/fftools/ffprobe.c > @@ -2741,8 +2741,11 @@ static int show_stream(WriterContext *w, > AVFormatContext *fmt_ctx, int stream_id > if (do_show_data) > writer_print_data(w, "extradata", par->extradata, >par->extradata_size); > -writer_print_data_hash(w, "extradata_hash", par->extradata, > -par->extradata_size); > + > +if (par->extradata_size > 0) { > +writer_print_data_hash(w, "extradata_hash", par->extradata, > +par->extradata_size); > +} > > /* Print disposition information */ > #define PRINT_DISPOSITION(flagname, name) do { > \ > diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov > b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov > index b69181ace7..4ef569df89 100644 > --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov > +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov > @@ -50,7 +50,6 @@ bits_per_raw_sample=N/A > nb_frames=1 > nb_read_frames=N/A > nb_read_packets=1 > -extradata_hash=adler32:0001 > DISPOSITION:default=1 > DISPOSITION:dub=0 > DISPOSITION:original=0 > diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov > b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov > index 16923e8684..70e7cdc943 100644 > --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov > +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov > @@ -50,7 +50,6 @@ bits_per_raw_sample=N/A > nb_frames=1 > nb_read_frames=N/A > nb_read_packets=1 > -extradata_hash=adler32:0001 > DISPOSITION:default=1 > DISPOSITION:dub=0 > DISPOSITION:original=0 > Which hashes crash when size is zero? Which do so when extradata is NULL with size == 0? - Andreas ___ 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 01/12] ffprobe: only hash extradata when it is present
Quoting Andreas Rheinhardt (2021-04-26 13:38:14) > Anton Khirnov: > > Passing zero-sized/NULL buffers to av_hash_update() is invalid and may > > crash with certain hashes. > > --- > > fftools/ffprobe.c | 7 +-- > > tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 - > > tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 - > > 3 files changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c > > index a2cb7dc986..9039985dcb 100644 > > --- a/fftools/ffprobe.c > > +++ b/fftools/ffprobe.c > > @@ -2741,8 +2741,11 @@ static int show_stream(WriterContext *w, > > AVFormatContext *fmt_ctx, int stream_id > > if (do_show_data) > > writer_print_data(w, "extradata", par->extradata, > >par->extradata_size); > > -writer_print_data_hash(w, "extradata_hash", par->extradata, > > -par->extradata_size); > > + > > +if (par->extradata_size > 0) { > > +writer_print_data_hash(w, "extradata_hash", par->extradata, > > +par->extradata_size); > > +} > > > > /* Print disposition information */ > > #define PRINT_DISPOSITION(flagname, name) do { > >\ > > diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov > > b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov > > index b69181ace7..4ef569df89 100644 > > --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov > > +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov > > @@ -50,7 +50,6 @@ bits_per_raw_sample=N/A > > nb_frames=1 > > nb_read_frames=N/A > > nb_read_packets=1 > > -extradata_hash=adler32:0001 > > DISPOSITION:default=1 > > DISPOSITION:dub=0 > > DISPOSITION:original=0 > > diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov > > b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov > > index 16923e8684..70e7cdc943 100644 > > --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov > > +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov > > @@ -50,7 +50,6 @@ bits_per_raw_sample=N/A > > nb_frames=1 > > nb_read_frames=N/A > > nb_read_packets=1 > > -extradata_hash=adler32:0001 > > DISPOSITION:default=1 > > DISPOSITION:dub=0 > > DISPOSITION:original=0 > > > Which hashes crash when size is zero? Which do so when extradata is NULL > with size == 0? Did not check in detail, but at least CRC32 crashes on NULL input. E.g.: ffprobe -show_streams -show_data_hash CRC32 samples/hap/HAPQA_NoSnappy_127x1.mov -- Anton Khirnov ___ 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] libavutil/cpu: Fix definition of _GNU_SOURCE so it occurs before other includes
On Mon, Apr 12, 2021 at 12:22 PM wrote: > > From: Kevin Wheatley > > This fix moves the potential definition of _GNU_SOURCE prior to > any includes of system header files as required by the documentation > https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html > > This corrects the CPU_COUNT macro availability, resulting in > sched_getaffinity() being called on Linux systems. This then correctly > returns the number of CPUs when run under containers and other cases > where processor affinity has been setup prior to running FFmpeg > bump As an FYI the issue is triggered because the inclusion of the other system headers prior to the _GNU_SOURCE definition results in the CPU_COUNT macro not being defined, and so the affinity based CPU counting fails to be used and so the cpu count is incorrectly returned. Kevin ___ 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] allows for independent codec setting per output video stream
Alexander Solonsky (12021-04-26): > Sometimes it is useful that output video streams have different gop > structure and other settings. Currently one setting used for all and I > added a posibility to have it separately It is already possible by suffixing options names with a colon and the number of the stream. Regards, -- Nicolas George 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] doc: update for adpcm_ima_ws encoder and wsaud muxer
Signed-off-by: Zane van Iperen --- doc/general_contents.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/general_contents.texi b/doc/general_contents.texi index 33ece6e884..e01347f8d4 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -695,7 +695,7 @@ library: @item Windows Televison (WTV) @tab X @tab X @item Wing Commander III movie @tab @tab X @tab Multimedia format used in Origin's Wing Commander III computer game. -@item Westwood Studios audio@tab @tab X +@item Westwood Studios audio@tab X @tab X @tab Multimedia format used in Westwood Studios games. @item Westwood Studios VQA @tab @tab X @tab Multimedia format used in Westwood Studios games. @@ -1162,7 +1162,7 @@ following image formats are supported: @item ADPCM Sound Blaster Pro 4-bit @tab @tab X @item ADPCM VIMA @tab @tab X @tab Used in LucasArts SMUSH animations. -@item ADPCM Westwood Studios IMA @tab @tab X +@item ADPCM Westwood Studios IMA @tab X @tab X @tab Used in Westwood Studios games like Command and Conquer. @item ADPCM Yamaha @tab X @tab X @item ADPCM Zork @tab @tab X -- 2.29.3 ___ 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 1/2] avformat/westwood_audenc: Check for, not assert on invalid data
Signed-off-by: Andreas Rheinhardt --- Is pkt->size * 4 actually supposed to be the size of audio after decoding? If so, the factor four would have to be changed to two for files flagged as 8 bit. (The 8/16 bit check seems broken; my actual intention with not unconditionally flagging the file as 16 bit was that remuxing content flagged as 8 bit should work, but it doesn't, because the current check only checks for the codec_id.) libavformat/westwood_audenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/westwood_audenc.c b/libavformat/westwood_audenc.c index 4ec905b088..490f2ee260 100644 --- a/libavformat/westwood_audenc.c +++ b/libavformat/westwood_audenc.c @@ -103,7 +103,8 @@ static int wsaud_write_packet(AVFormatContext *ctx, AVPacket *pkt) AVIOContext *pb = ctx->pb; AUDMuxContext *a = ctx->priv_data; -av_assert1(pkt->size < UINT16_MAX && (pkt->size * 4) < UINT16_MAX); +if (pkt->size > UINT16_MAX / 4) +return AVERROR_INVALIDDATA; /* Assumes ADPCM since this muxer doesn't support SND1 or PCM format. */ avio_wl16(pb, pkt->size); avio_wl16(pb, pkt->size * 4); -- 2.27.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 2/2] avformat/westwood_audenc: Remove unused variable
Signed-off-by: Andreas Rheinhardt --- libavformat/westwood_audenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/westwood_audenc.c b/libavformat/westwood_audenc.c index 490f2ee260..e5a6e644fc 100644 --- a/libavformat/westwood_audenc.c +++ b/libavformat/westwood_audenc.c @@ -73,7 +73,6 @@ static int wsaud_write_header(AVFormatContext *ctx) AVStream *st = ctx->streams[0]; AVIOContext *pb = ctx->pb; AUDMuxContext *a = ctx->priv_data; -int ret; unsigned char flags = 0; a->uncomp_size = 0; -- 2.27.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 07/34] avcodec/dvenc: Avoid copying packet data
On Mon, Apr 26, 2021 at 12:34:21AM +0200, Andreas Rheinhardt wrote: > When the packet size is known in advance like here, one can avoid > an intermediate buffer for the packet data. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/dvenc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) this seems to break fate here: not sure why or if i did something wrong TESTvsynth1-dv-hd --- ./tests/ref/vsynth/vsynth1-dv-hd2021-04-25 11:26:39.215771845 +0200 +++ tests/data/fate/vsynth1-dv-hd 2021-04-26 15:02:16.645954326 +0200 @@ -1,4 +1,4 @@ -b2bcafc74dec5f9ca516cb25dd07459b *tests/data/fate/vsynth1-dv-hd.dv +382fbccaf3b3071895b30d9360f96c11 *tests/data/fate/vsynth1-dv-hd.dv 1440 tests/data/fate/vsynth1-dv-hd.dv 34b78cf725346c7f819c9d6209b8299a *tests/data/fate/vsynth1-dv-hd.out.rawvideo stddev:4.30 PSNR: 35.45 MAXDIFF: 74 bytes: 7603200/ 7603200 Test vsynth1-dv-hd failed. Look at tests/data/fate/vsynth1-dv-hd.err for details. tests/Makefile:255: recipe for target 'fate-vsynth1-dv-hd' failed make: *** [fate-vsynth1-dv-hd] Error 1 [...] -- 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 07/34] avcodec/dvenc: Avoid copying packet data
Michael Niedermayer: > On Mon, Apr 26, 2021 at 12:34:21AM +0200, Andreas Rheinhardt wrote: >> When the packet size is known in advance like here, one can avoid >> an intermediate buffer for the packet data. >> >> Signed-off-by: Andreas Rheinhardt >> --- >> libavcodec/dvenc.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) > > this seems to break fate here: > not sure why or if i did something wrong > > TESTvsynth1-dv-hd > --- ./tests/ref/vsynth/vsynth1-dv-hd 2021-04-25 11:26:39.215771845 +0200 > +++ tests/data/fate/vsynth1-dv-hd 2021-04-26 15:02:16.645954326 +0200 > @@ -1,4 +1,4 @@ > -b2bcafc74dec5f9ca516cb25dd07459b *tests/data/fate/vsynth1-dv-hd.dv > +382fbccaf3b3071895b30d9360f96c11 *tests/data/fate/vsynth1-dv-hd.dv > 1440 tests/data/fate/vsynth1-dv-hd.dv > 34b78cf725346c7f819c9d6209b8299a *tests/data/fate/vsynth1-dv-hd.out.rawvideo > stddev:4.30 PSNR: 35.45 MAXDIFF: 74 bytes: 7603200/ 7603200 > Test vsynth1-dv-hd failed. Look at tests/data/fate/vsynth1-dv-hd.err for > details. > tests/Makefile:255: recipe for target 'fate-vsynth1-dv-hd' failed > make: *** [fate-vsynth1-dv-hd] Error 1 > > [...] > I tested this whole patchset with ASAN and somehow all the memory ff_alloc_packet2() returned was initially zeroed, as is the case with av_fast_padded_malloc() (which is currently used here). This encoder seems to rely on this. I have not done an in-depth investigation, but the diff has lots of 80-byte blocks of which only the first three bytes are actually written: < 00046460: 96bf 8500 < 00046470: < 00046480: < 00046490: < 000464a0: < 000464b0: 96bf 8600 < 000464c0: < 000464d0: < 000464e0: < 000464f0: > 00046460: 96bf 852a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a ...* > 00046470: 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a > 00046480: 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a > 00046490: 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a > 000464a0: 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a > 000464b0: 96bf 862a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a ...* > 000464c0: 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a > 000464d0: 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a > 000464e0: 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a > 000464f0: 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a 2a2a (This is the output after I made av_realloc poison the returned memory in case the original pointer was NULL, i.e. if it is a new allocation. Maybe this should be added to CONFIG_MEMORY_POISON? I would have found this issue directly if it were so.) - Andreas ___ 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 v3 0/4] Initial region (styling) support for TTML
On Mon, Apr 26, 2021 at 12:34 PM Jan Ekström wrote: > > Now sets alignment, font size, font family and the region's position > and size according to the ASS styles passed to the encoder. Regions are > relatively important in TTML, since the spec-defined default region is in > raster location (similar to the default with HTML) - it starts from the > top left corner and covers the whole screen. > > Mapping of the ASS script resolution to the cell resolution and using cells as > sizing metric is not perfect, but while TTML does have a pixel based reference > sizing by means of setting an extent to the root tt element, it is > specifically > disallowed in the EBU-TT profile, as well as apparently generally frowned upon > as opposed to defining the cell resolution. In general, mapping to cell > resolution > seems to give "close enough" results, though. > > FATE test output still passes https://github.com/skynav/ttt/ validation, > and visually the result can be verified against such renderers as > http://sandflow.com/imsc1_1/index.html . > > Changes from v2: > * Noticed that taking a pointer to an already dereferenced style in > libavcodec/ttmlenc.c > is unnecessary and complicates the style-writing function for no real > reason. > Thus, made the function just take in the struct, as opposed to a pointer to > a struct. > > Will still be pushing this patch set in soon, posting this minor revision of > the > patch set just so that it is in the mailing list archives and patchwork's > automation > can poke at it. > Just like locally, the patchwork CI FATE jobs for both x86_64 and PPC64 passed. Thus applied this set as: b71184faefce38c8a965c7d0e8552e049ae9e150 464d6ed98d67fe0c3819516e9b0ca5edaf956a0e 3ef5a8ba2b7798ea4e5708c5644fa60dd00bde06 b24488e7277af2a4b77a33fa795b4df5979b0fcd Thanks to those who reviewed this set, Jan ___ 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] doc: update for adpcm_ima_ws encoder and wsaud muxer
On 2021-04-26 18:24, Zane van Iperen wrote: Signed-off-by: Zane van Iperen --- doc/general_contents.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/general_contents.texi b/doc/general_contents.texi index 33ece6e884..e01347f8d4 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -695,7 +695,7 @@ library: @item Windows Televison (WTV) @tab X @tab X @item Wing Commander III movie @tab @tab X @tab Multimedia format used in Origin's Wing Commander III computer game. -@item Westwood Studios audio@tab @tab X +@item Westwood Studios audio@tab X @tab X @tab Multimedia format used in Westwood Studios games. @item Westwood Studios VQA @tab @tab X @tab Multimedia format used in Westwood Studios games. @@ -1162,7 +1162,7 @@ following image formats are supported: @item ADPCM Sound Blaster Pro 4-bit @tab @tab X @item ADPCM VIMA @tab @tab X @tab Used in LucasArts SMUSH animations. -@item ADPCM Westwood Studios IMA @tab @tab X +@item ADPCM Westwood Studios IMA @tab X @tab X @tab Used in Westwood Studios games like Command and Conquer. @item ADPCM Yamaha @tab X @tab X @item ADPCM Zork @tab @tab X LGTM. 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".
Re: [FFmpeg-devel] Hardware purchase request
Apr 8, 2021, 00:24 by mich...@niedermayer.cc: > On Sat, Apr 03, 2021 at 10:32:13PM +0200, Lynne wrote: > >> Apr 3, 2021, 20:12 by mich...@niedermayer.cc: >> >> > On Sat, Apr 03, 2021 at 03:01:16PM +0200, Lynne wrote: >> > >> >> Apr 2, 2021, 23:28 by mich...@niedermayer.cc: >> >> >> >> > On Mon, Mar 29, 2021 at 11:03:16PM +0300, Jan Ekström wrote: >> >> > >> >> > IMO some of this list is quite reasonable like a 1TB NVME, then iam not >> >> > sure why you need a 2nd one. That can be needed of course but its not >> >> > clear >> >> > from just the list. But really i dont want to "critique" the list, it >> >> > just >> >> > overall feels like there was a misunderstanding and iam happy to approve >> >> > a machiene in the 2-3k range or also higher if its explained why its >> >> > needed >> >> > for FFmpeg >> >> > >> >> > and sorry for my late reply >> >> > >> >> >> >> By removing the screen (could borrow one for now), half the RAM, the >> >> second SSD, >> >> and changing the motherboard, I can get this down to 4400 EUR. >> >> Unfortunately, the CPU and GPU constitute a large amount of the sum and >> >> not >> >> even downgrading them to a 6800 and a 5900 helps, in fact both of those >> >> are >> >> completely out of stock wherever I checked, since they used to be cheaper. >> >> So now there's mostly only the higher end options left, if at all. >> >> I could probably change the RAM to save on an additional 100 EUR, but >> >> I don't see this going below 4000 EUR. >> >> In the past you could probably have gotten away with much less, but like >> >> I said, >> >> there's a chip shortage going on where everything is much more expensive >> >> than it otherwise should have been, if it's even available in stock. >> >> >> > >> > do we have some idea about when the shortage will be resolved ? >> > >> >> I expect it to end a few months after the pandemic ends. >> And I wish I knew when that would happen, if it will even happen at all. >> >> I searched some more and swapped for a Rocket Lake chip, which I managed >> to find, which also allowed me to swap the motherboard for one cheaper still, >> so I managed to bring the price down to 3900EUR. >> >> The main bulk of the cost is still the GPU, which goes for nearly >> twice the price of its release. Sadly, coin miners are keeping demand >> and therefore cost up. It's been like this for many years, or so I hear. >> >> If someone from AMD is listening and wants to help out like what >> happened some years ago, it would be most welcome. >> But as far as I know, no one in the FFmpeg + VLC community has any >> contacts in AMD at all these days. >> > > If no other solution is found and noone objects, i wont object to > a ~4k system. The timing is a bit unfortunate with the chip shortage > also please dont try to reduce it at any cost. if you can gain something > significant for the project by adding 100€, do it. > It's been a few weeks, should I make a final list? > Of course if someone from AMD or maybe some cryoto currency miner could > donate hw that would be nice. > No one has reached out, unfortunately. ___ 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] avformat/westwood_audenc: Check for, not assert on invalid data
On 26/04/2021 14:01, Andreas Rheinhardt wrote: Signed-off-by: Andreas Rheinhardt --- Is pkt->size * 4 actually supposed to be the size of audio after decoding? If so, the factor four would have to be changed to two for files flagged as 8 bit. (The 8/16 bit check seems broken; my actual intention with not unconditionally flagging the file as 16 bit was that remuxing content flagged as 8 bit should work, but it doesn't, because the current check only checks for the codec_id.) libavformat/westwood_audenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/westwood_audenc.c b/libavformat/westwood_audenc.c index 4ec905b088..490f2ee260 100644 --- a/libavformat/westwood_audenc.c +++ b/libavformat/westwood_audenc.c @@ -103,7 +103,8 @@ static int wsaud_write_packet(AVFormatContext *ctx, AVPacket *pkt) AVIOContext *pb = ctx->pb; AUDMuxContext *a = ctx->priv_data; -av_assert1(pkt->size < UINT16_MAX && (pkt->size * 4) < UINT16_MAX); +if (pkt->size > UINT16_MAX / 4) +return AVERROR_INVALIDDATA; /* Assumes ADPCM since this muxer doesn't support SND1 or PCM format. */ avio_wl16(pb, pkt->size); avio_wl16(pb, pkt->size * 4); You are right, I didn't get the check quite right, I actually struggled to get a field that would provide the correct information as the suggested bits_per_raw_sample contained 0 when I tested it, resulting in incorrectly flagged files. I wasn't really sure how else to solve it and in hindsight the check I added didn't really do anything. The demuxer also appears to suffer from the same limitation as it ignores checking the flag in the header for 16bit and just assumes it is and the decoder as well as the new encoder both also assume they are handling 16bit samples. -- Aidan Richmond ___ 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] allows for independent codec setting per output video stream
Alexander Solonsky (12021-04-26): > I guess it is supposed to work in this way but it doesn't. And if you look > in the code you will see, than only one codec_opt is served for all c:v:0, > c:v:1 etc. I checked it works before replying. Do not top-post on this mailing-list. If you don't know what it means look it up. Regards, -- Nicolas George 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] avformat/adtsenc: clarify option help
Will apply tomorrow. On 2021-04-26 16:52, Gyan Doshi wrote: Also remove unnecessary unit as option does not accept any constants. --- libavformat/adtsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index ae1b1b364c..19262784ce 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -216,7 +216,7 @@ static int adts_write_trailer(AVFormatContext *s) static const AVOption options[] = { { "write_id3v2", "Enable ID3v2 tag writing", OFFSET(id3v2tag), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, ENC}, { "write_apetag", "Enable APE tag writing", OFFSET(apetag), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, ENC}, -{ "write_mpeg2", "Use MPE2 ID when writing", OFFSET(mpeg_id), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, ENC, "mpeg_id"}, +{ "write_mpeg2", "Set MPEG version to MPEG-2", OFFSET(mpeg_id), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, ENC}, { NULL }, }; ___ 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] allows for independent codec setting per output video stream
Alexander Solonsky (12021-04-26): > maybe let's get on the same page what we both think is working and what not. > I used this simple script: > ffmpeg -i $1 -map 0:v:0 -c:v:0 libx264 -x264-params "keyint=24:bframes=1" > -map 0:v:0 -c:v:1 libx264 -x264-params "keyint=72:bframes=3" $2 -y > to create 2 streams out of 1 with different gop structure. And ffmpeg as it > is currently produces both streams with keyint=72 and bframes=3. With my > patch each stream preserves the x264 params set individually. Which script > you used, that you could get for the similar scenario two different gop > sized streams? You specified -x264-params for all streams, it applies to all streams. You need to use a stream specifier. For further questions, please ask on the users mailing-lists. Regards, -- Nicolas George 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] allows for independent codec setting per output video stream
Sometimes it is useful that output video streams have different gop structure and other settings. Currently one setting used for all and I added a posibility to have it separately --- fftools/cmdutils.c | 22 -- fftools/cmdutils.h | 2 ++ fftools/ffmpeg_opt.c | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index fe424b6a4c..4a3520b84b 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -67,7 +67,8 @@ static int init_report(const char *env); AVDictionary *sws_dict; AVDictionary *swr_opts; -AVDictionary *format_opts, *codec_opts, *resample_opts; +AVDictionary *format_opts, *codec_opts, *resample_opts, *codec_opts_aux[MAX_CODEC_OPTS]; +int codec_opts_aux_counter = 0; static FILE *report_file; static int report_file_level = AV_LOG_DEBUG; @@ -86,11 +87,16 @@ void init_opts(void) void uninit_opts(void) { +int i; + av_dict_free(&swr_opts); av_dict_free(&sws_dict); av_dict_free(&format_opts); av_dict_free(&codec_opts); av_dict_free(&resample_opts); +for(i = 0; i < codec_opts_aux_counter; i ++) +av_dict_free(&codec_opts_aux[i]); + } void log_callback_help(void *ptr, int level, const char *fmt, va_list vl) @@ -567,6 +573,10 @@ int opt_default(void *optctx, const char *opt, const char *arg) ((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') && (o = opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ { av_dict_set(&codec_opts, opt, arg, FLAGS); +av_dict_set(&codec_opts_aux[codec_opts_aux_counter], opt, arg, FLAGS); +if(codec_opts_aux_counter + 1 < MAX_CODEC_OPTS) +codec_opts_aux_counter ++; +// if more streams require separate codec opts - the rest will have to use the latest setting consumed = 1; } if ((o = opt_find(&fc, opt, NULL, 0, @@ -660,6 +670,7 @@ static void finish_group(OptionParseContext *octx, int group_idx, { OptionGroupList *l = &octx->groups[group_idx]; OptionGroup *g; +int i; GROW_ARRAY(l->groups, l->nb_groups); g = &l->groups[l->nb_groups - 1]; @@ -673,6 +684,11 @@ static void finish_group(OptionParseContext *octx, int group_idx, g->format_opts = format_opts; g->resample_opts = resample_opts; +for(i = 0; i < codec_opts_aux_counter; i ++) +g->codec_opts_aux[i] = codec_opts_aux[i]; + +for(i = 0; i < codec_opts_aux_counter; i ++) +codec_opts_aux[i] = NULL; codec_opts = NULL; format_opts = NULL; resample_opts = NULL; @@ -722,7 +738,7 @@ static void init_parse_context(OptionParseContext *octx, void uninit_parse_context(OptionParseContext *octx) { -int i, j; +int i, j, k; for (i = 0; i < octx->nb_groups; i++) { OptionGroupList *l = &octx->groups[i]; @@ -735,6 +751,8 @@ void uninit_parse_context(OptionParseContext *octx) av_dict_free(&l->groups[j].sws_dict); av_dict_free(&l->groups[j].swr_opts); +for (k = 0; k < codec_opts_aux_counter; k ++) +av_dict_free(&l->groups[j].codec_opts_aux[k]); } av_freep(&l->groups); } diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h index 5da9f4c88f..238b80857f 100644 --- a/fftools/cmdutils.h +++ b/fftools/cmdutils.h @@ -308,6 +308,7 @@ typedef struct OptionGroupDef { int flags; } OptionGroupDef; +#define MAX_CODEC_OPTS 16 typedef struct OptionGroup { const OptionGroupDef *group_def; const char *arg; @@ -316,6 +317,7 @@ typedef struct OptionGroup { int nb_opts; AVDictionary *codec_opts; +AVDictionary *codec_opts_aux[MAX_CODEC_OPTS]; AVDictionary *format_opts; AVDictionary *resample_opts; AVDictionary *sws_dict; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 807e783422..a02e05f081 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1474,7 +1474,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e AVIOContext *s = NULL; char *buf = NULL, *arg = NULL, *preset = NULL; -ost->encoder_opts = filter_codec_opts(o->g->codec_opts, ost->enc->id, oc, st, ost->enc); +ost->encoder_opts = filter_codec_opts(o->g->codec_opts_aux[ost->index], ost->enc->id, oc, st, ost->enc); MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); ost->autoscale = 1; -- 2.28.0.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 1/2] avcodec/vc2enc: Actually zero padding
This encoder sets the min_size in ff_alloc_packet2(), so it can not rely on av_packet_make_refcounted() to zero the padding. Signed-off-by: Andreas Rheinhardt --- libavcodec/vc2enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c index 7bd2e4c2ab..6c2e873a23 100644 --- a/libavcodec/vc2enc.c +++ b/libavcodec/vc2enc.c @@ -993,7 +993,7 @@ static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } flush_put_bits(&s->pb); -avpkt->size = put_bits_count(&s->pb) >> 3; +av_shrink_packet(avpkt, put_bytes_output(&s->pb)); *got_packet = 1; -- 2.27.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 2/2] avutil/mem: Also poison new av_realloc-allocated blocks
Signed-off-by: Andreas Rheinhardt --- libavutil/mem.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavutil/mem.c b/libavutil/mem.c index cfb6d8ab8f..fa227f5e12 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -133,14 +133,20 @@ void *av_malloc(size_t size) void *av_realloc(void *ptr, size_t size) { +void *ret; if (size > max_alloc_size) return NULL; #if HAVE_ALIGNED_MALLOC -return _aligned_realloc(ptr, size + !size, ALIGN); +ret = _aligned_realloc(ptr, size + !size, ALIGN); #else -return realloc(ptr, size + !size); +ret = realloc(ptr, size + !size); #endif +#if CONFIG_MEMORY_POISONING +if (ret && !ptr) +memset(ret, FF_MEMORY_POISON, size); +#endif +return ret; } void *av_realloc_f(void *ptr, size_t nelem, size_t elsize) -- 2.27.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 30/34] avcodec/libvpxenc: Avoid copying packet data
On Sun, Apr 25, 2021 at 3:39 PM Andreas Rheinhardt wrote: > > Here the packet size is known before allocating the packet because > the encoder provides said information (and works with internal buffers > itself), so one can pass this information to ff_alloc_packet2() to > avoid the implicit use of another intermediate buffer for the packet data. > > Signed-off-by: Andreas Rheinhardt > --- > Will get rid of this unnecessary level of indirection in storeframe() > after the bump. > > libavcodec/libvpxenc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > lgtm. ___ 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/encode: Zero padding in ff_get_encode_buffer()
The documentation of the get_encode_buffer() callback does not require to zero the padding; therefore we do it in ff_get_encode_buffer(). This also constitutes an implicit check for whether the buffer is actually allocated with padding. The memset in avcodec_default_get_encode_buffer() is now redundant and has been removed. Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 9a4140f91a..75129c8646 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -74,7 +74,6 @@ int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, in return ret; } avpkt->data = avpkt->buf->data; -memset(avpkt->data + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); return 0; } @@ -98,6 +97,7 @@ int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, i ret = AVERROR(EINVAL); goto fail; } +memset(avpkt->data + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ret = 0; fail: -- 2.27.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] allows for independent codec setting per output video stream
Hi Nicolas, I guess it is supposed to work in this way but it doesn't. And if you look in the code you will see, than only one codec_opt is served for all c:v:0, c:v:1 etc. Best regards, Alexander /// On Mon, Apr 26, 2021 at 7:54 PM Nicolas George wrote: > Alexander Solonsky (12021-04-26): > > Sometimes it is useful that output video streams have different gop > > structure and other settings. Currently one setting used for all and I > > added a posibility to have it separately > > It is already possible by suffixing options names with a colon and the > number of the stream. > > Regards, > > -- > Nicolas George > ___ 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] allows for independent codec setting per output video stream
I checked it works before replying. Thanks, maybe let's get on the same page what we both think is working and what not. I used this simple script: ffmpeg -i $1 -map 0:v:0 -c:v:0 libx264 -x264-params "keyint=24:bframes=1" -map 0:v:0 -c:v:1 libx264 -x264-params "keyint=72:bframes=3" $2 -y to create 2 streams out of 1 with different gop structure. And ffmpeg as it is currently produces both streams with keyint=72 and bframes=3. With my patch each stream preserves the x264 params set individually. Which script you used, that you could get for the similar scenario two different gop sized streams? Thanks, Alexander /// ___ 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/encode: Zero padding in ff_get_encode_buffer()
On 4/26/2021 3:52 PM, Andreas Rheinhardt wrote: The documentation of the get_encode_buffer() callback does not require to zero the padding; therefore we do it in ff_get_encode_buffer(). This also constitutes an implicit check for whether the buffer is actually allocated with padding. The memset in avcodec_default_get_encode_buffer() is now redundant and has been removed. Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 9a4140f91a..75129c8646 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -74,7 +74,6 @@ int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, in return ret; } avpkt->data = avpkt->buf->data; -memset(avpkt->data + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); return 0; } @@ -98,6 +97,7 @@ int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, i ret = AVERROR(EINVAL); goto fail; } +memset(avpkt->data + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ret = 0; fail: LGTM. ___ 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 1/1] configure: add emscripten support
From: Mehdi Sabwat Fix configure test to allow it to have the right suffix when $target_os=emscripten --- configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure b/configure index cc1013fb1d..501c715b82 100755 --- a/configure +++ b/configure @@ -4381,6 +4381,7 @@ fi exesuf() { case $1 in mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;; +emscripten) echo .js ;; esac } @@ -5580,6 +5581,8 @@ case $target_os in ;; minix) ;; +emscripten) +;; none) ;; *) -- 2.31.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".
Re: [FFmpeg-devel] [PATCH] Pass the HDR10+ metadata to the packet side data in VP9 encoder
On Fri, Apr 23, 2021 at 11:53 AM James Zern wrote: > Hi, > > On Fri, Apr 23, 2021 at 8:58 AM Mohammad Izadi > wrote: > > > > HDR10+ metadata is stored in the bit stream for HEVC. The story is > different for VP9 and cannot store the metadata in the bit stream. HDR10+ > should be passed to packet side data an stored in the container (mkv) for > VP9. > > > > This CL is taking HDR10+ from AVFrame side data in libvpxenc and is > passing it to the AVPacket side data. > > --- > > libavcodec/avpacket.c | 1 + > > libavcodec/decode.c| 1 + > > libavcodec/libvpxenc.c | 71 ++ > > libavcodec/packet.h| 10 +- > > 4 files changed, 82 insertions(+), 1 deletion(-) > > > > Just some quick cosmetics, I didn't take a close look at the > implementation. > > > [...] > > +static int copy_hdr10_plus_to_pkt(void *list, AVPacket *pkt) > > +{ > > +struct FrameHDR10PlusList **p = list; > > +struct FrameHDR10PlusList *head = *p; > > + > > +if(head && pkt && head->hdr10_plus && head->pts == pkt->pts) { > > Add whitespace after 'if' and elsewhere before the '{'. You can use > tools/patcheck as a guide to the formatting [1]. > *Fixed.* > > > [...] > > > > @@ -1245,6 +1300,12 @@ FF_ENABLE_DEPRECATION_WARNINGS > > AV_WB64(side_data, 1); > > memcpy(side_data + 8, cx_frame->buf_alpha, > cx_frame->sz_alpha); > > } > > +if(cx_frame->frame_number != -1) { // Not invisible frame > > VP9 won't emit frames like this, but this is a shared path with VP8. Can > we get > this metadata (unnecessarily) when doing a 8-bit encode? > *Great point! planned to discard it in matroska, but we can discard HDR10+ if it is PQ HDR (high bit depth and SPMTE2084). We shouldn't get it. Fixed in the code.* > > +VPxContext *ctx = avctx->priv_data; > > +int err = copy_hdr10_plus_to_pkt(&ctx->hdr10_plus_list, > pkt); > > +if (err < 0) > > +return err; > > +} > > } else { > > return ret; > > } > > @@ -1579,6 +1640,7 @@ static int vpx_encode(AVCodecContext *avctx, > AVPacket *pkt, > > const struct vpx_codec_enc_cfg *enccfg = ctx->encoder.config.enc; > > vpx_svc_layer_id_t layer_id; > > int layer_id_valid = 0; > > +AVFrameSideData *hdr10_plus_metadata; > > > > if (frame) { > > const AVFrameSideData *sd = av_frame_get_side_data(frame, > AV_FRAME_DATA_REGIONS_OF_INTEREST); > > @@ -1655,6 +1717,15 @@ static int vpx_encode(AVCodecContext *avctx, > AVPacket *pkt, > > vp9_encode_set_roi(avctx, frame->width, frame->height, > sd); > > } > > } > > + > > +// Add HDR10+ metadata to queue. > > +hdr10_plus_metadata = av_frame_get_side_data(frame, > AV_FRAME_DATA_DYNAMIC_HDR_PLUS); > > +if(hdr10_plus_metadata){ > > +struct FrameHDR10PlusList *data = av_malloc(sizeof(struct > FrameHDR10PlusList)); > > This allocation should be checked and prefer sizeof(*data). > *Fixed.* > > > +data->pts = frame->pts; > > +data->hdr10_plus = av_buffer_ref(hdr10_plus_metadata->buf); > > +add_hdr10_plus(&ctx->hdr10_plus_list, data); > > +} > > } > > > > // this is for encoding with preset temporal layering patterns > defined in > > diff --git a/libavcodec/packet.h b/libavcodec/packet.h > > index ca18ae631f..89e683b357 100644 > > --- a/libavcodec/packet.h > > +++ b/libavcodec/packet.h > > @@ -298,7 +298,15 @@ enum AVPacketSideDataType { > > * If its value becomes huge, some code using it > > * needs to be updated as it assumes it to be smaller than other > limits. > > */ > > -AV_PKT_DATA_NB > > +AV_PKT_DATA_NB, > > This should be the final entry in the enum, see the comment above. > *Fixed.* > > > > + > > +/** > > + * HDR10+ dynamic metadata associated with a video frame. The > metadata is in > > + * the form of the AVDynamicHDRPlus struct and contains > > + * information for color volume transform - application 4 of > > + * SPMTE 2094-40:2016 standard. > > + */ > > +AV_PKT_DATA_DYNAMIC_HDR10_PLUS > > }; > > > > #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS > //DEPRECATED > > [1] https://ffmpeg.org/developer.html#Coding-Rules-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 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] Pass the HDR10+ metadata to the packet side data in VP9 encoder
HDR10+ metadata is stored in the bit stream for HEVC. The story is different for VP9 and cannot store the metadata in the bit stream. HDR10+ should be passed to packet side data an stored in the container (mkv) for VP9. This CL is taking HDR10+ from AVFrame side data in libvpxenc and is passing it to the AVPacket side data. --- libavcodec/avpacket.c | 1 + libavcodec/decode.c| 1 + libavcodec/libvpxenc.c | 88 +- libavcodec/packet.h| 8 4 files changed, 96 insertions(+), 2 deletions(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index b5bac5c5f2..7a3b0a73e3 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -416,6 +416,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type) case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile"; case AV_PKT_DATA_DOVI_CONF: return "DOVI configuration record"; case AV_PKT_DATA_S12M_TIMECODE: return "SMPTE ST 12-1:2014 timecode"; +case AV_PKT_DATA_DYNAMIC_HDR10_PLUS: return "HDR10+ Dynamic Metadata (SMPTE 2094-40)"; } return NULL; } diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 0956a6ac6f..bf5fbcca97 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1736,6 +1736,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC }, { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE }, { AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE }, +{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, }; if (IS_EMPTY(pkt) && av_fifo_size(avctx->internal->pkt_props) >= sizeof(*pkt)) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 3f36943c12..2096c08437 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -63,6 +63,12 @@ struct FrameListData { struct FrameListData *next; }; +typedef struct FrameHDR10PlusList { +int64_t pts; +AVBufferRef *hdr10_plus; +struct FrameHDR10PlusList *next; +} FrameHDR10PlusList; + typedef struct VPxEncoderContext { AVClass *class; struct vpx_codec_ctx encoder; @@ -120,6 +126,8 @@ typedef struct VPxEncoderContext { int tune_content; int corpus_complexity; int tpl_model; +int discard_hdr10_plus; +struct FrameHDR10PlusList *hdr10_plus_list; /** * If the driver does not support ROI then warn the first time we * encounter a frame with ROI side data. @@ -315,6 +323,53 @@ static av_cold void free_frame_list(struct FrameListData *list) } } + +static void add_hdr10_plus(void *list, struct FrameHDR10PlusList *data) +{ +struct FrameHDR10PlusList **p = list; +while (*p) +p = &(*p)->next; +*p = data; +data->next = NULL; +} + +static av_cold void free_hdr10_plus(struct FrameHDR10PlusList *p) +{ +av_buffer_unref(&p->hdr10_plus); +av_free(p); +} + +static av_cold void free_hdr10_plus_list(struct FrameHDR10PlusList *list) +{ +struct FrameHDR10PlusList *p = list; +while (p) { +list = list->next; +free_hdr10_plus(p); +p = list; +} +} + +static int copy_hdr10_plus_to_pkt(void *list, AVPacket *pkt) +{ +struct FrameHDR10PlusList **p = list; +struct FrameHDR10PlusList *head = *p; + +if (head && pkt && head->hdr10_plus && head->pts == pkt->pts) { +uint8_t *data; +*p = (*p)->next; +data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, head->hdr10_plus->size); + +if (!data) { +free_hdr10_plus(head); +return AVERROR(ENOMEM); +} +memcpy(data, head->hdr10_plus->data, head->hdr10_plus->size); +free_hdr10_plus(head); + +} +return 0; +} + static av_cold int codecctl_int(AVCodecContext *avctx, enum vp8e_enc_control_id id, int val) { @@ -383,6 +438,7 @@ static av_cold int vpx_free(AVCodecContext *avctx) av_freep(&ctx->twopass_stats.buf); av_freep(&avctx->stats_out); free_frame_list(ctx->coded_frame_list); +free_hdr10_plus_list(ctx->hdr10_plus_list); return 0; } @@ -828,6 +884,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, AVCPBProperties *cpb_props; int res; vpx_img_fmt_t img_fmt = VPX_IMG_FMT_I420; +ctx->discard_hdr10_plus = 1; #if CONFIG_LIBVPX_VP9_ENCODER vpx_codec_caps_t codec_caps = vpx_codec_get_caps(iface); vpx_svc_extra_cfg_t svc_params; @@ -850,11 +907,16 @@ static av_cold int vpx_init(AVCodecContext *avctx, if (avctx->codec_id == AV_CODEC_ID_VP9) { if (set_pix_fmt(avctx, codec_caps, &enccfg, &flags, &img_fmt)) return AVERROR(EINVAL); +// Keep HDR10+ if it has bit depth higher than 8 and +// it has PQ trc (SMPTE2084). +if (enccfg.g_bit_depth > 8 && avctx->c
Re: [FFmpeg-devel] [PATCH v2] lavfi/dnn/queue.h: Add Documentation to Queue
> -Original Message- > From: ffmpeg-devel On Behalf Of > Shubhanshu Saxena > Sent: 2021年4月26日 15:54 > To: ffmpeg-devel@ffmpeg.org > Cc: Shubhanshu Saxena > Subject: [FFmpeg-devel] [PATCH v2] lavfi/dnn/queue.h: Add Documentation > to Queue > > Documentation for Queue > > Signed-off-by: Shubhanshu Saxena > --- > libavfilter/dnn/queue.h | 75 > + > 1 file changed, 75 insertions(+) > > diff --git a/libavfilter/dnn/queue.h b/libavfilter/dnn/queue.h > index 4d7121366a..2524d5fa59 100644 > --- a/libavfilter/dnn/queue.h > +++ b/libavfilter/dnn/queue.h > @@ -22,20 +22,95 @@ LGTM, both patches pushed, thanks. ___ 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/6] doc/filters: correct http link
> -Original Message- > From: ffmpeg-devel On Behalf Of > lance.lmw...@gmail.com > Sent: 2021年4月26日 18:49 > To: ffmpeg-devel@ffmpeg.org > Cc: Limin Wang > Subject: [FFmpeg-devel] [PATCH 1/6] doc/filters: correct http link > > From: Limin Wang > > Signed-off-by: Limin Wang > --- > doc/filters.texi | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/doc/filters.texi b/doc/filters.texi > index 67587d9..e99d70a 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -9886,7 +9886,7 @@ Native implementation of DNN loading and > execution. > @item tensorflow > TensorFlow backend. To enable this backend you > need to install the TensorFlow for C library (see > -@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg > with > +@url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg > with > @code{--enable-libtensorflow} > @end table > Default value is @samp{native}. > @@ -10187,7 +10187,7 @@ Native implementation of DNN loading and > execution. > @item tensorflow > TensorFlow backend. To enable this backend you > need to install the TensorFlow for C library (see > -@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg > with > +@url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg > with > @code{--enable-libtensorflow} > > @item openvino > @@ -18893,7 +18893,7 @@ Native implementation of DNN loading and > execution. > @item tensorflow > TensorFlow backend. To enable this backend you > need to install the TensorFlow for C library (see > -@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg > with > +@url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg > with > @code{--enable-libtensorflow} > @end table > LGTM, will push soon, thanks. ___ 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/6] avfilter/vf_sr: add options for backend configs
> -Original Message- > From: ffmpeg-devel On Behalf Of > lance.lmw...@gmail.com > Sent: 2021年4月26日 18:49 > To: ffmpeg-devel@ffmpeg.org > Cc: Limin Wang > Subject: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_sr: add options for backend > configs > > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavfilter/vf_sr.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c > index 45f941a..282c468 100644 > --- a/libavfilter/vf_sr.c > +++ b/libavfilter/vf_sr.c > @@ -55,6 +55,8 @@ static const AVOption sr_options[] = { > { "model", "path to model file specifying network architecture and its > parameters", OFFSET(dnnctx.model_filename), AV_OPT_TYPE_STRING, > {.str=NULL}, 0, 0, FLAGS }, > { "input", "input name of the model", > OFFSET(dnnctx.model_inputname), AV_OPT_TYPE_STRING,{ .str = > "x" }, 0, 0, FLAGS }, > { "output", "output name of the model", > OFFSET(dnnctx.model_outputname), AV_OPT_TYPE_STRING,{ .str = > "y" }, 0, 0, FLAGS }, > +{ "backend_configs","backend configs", > OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = > NULL }, 0, 0, FLAGS }, > +{ "options","backend configs", > OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = > NULL }, 0, 0, FLAGS }, > { NULL } > }; > vf_dnn_processing.c is designed to cover all the cases for image/video processing with M inputs and N outputs (currently only M=1 and N=1 is supported), covering the features of vf_sr.c and vf_derain.c. To avoid duplicate/similar code in different filters, we don't add more feature in vf_sr.c/vf_derain.c, we just keep supporting their current feature. ___ 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/6] doc/filters: documentation to options for backend
> -Original Message- > From: ffmpeg-devel On Behalf Of > lance.lmw...@gmail.com > Sent: 2021年4月26日 18:49 > To: ffmpeg-devel@ffmpeg.org > Cc: Limin Wang > Subject: [FFmpeg-devel] [PATCH 3/6] doc/filters: documentation to options > for backend > > From: Limin Wang > > Signed-off-by: Limin Wang > --- > doc/filters.texi | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/doc/filters.texi b/doc/filters.texi > index e99d70a..a959127 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -10159,6 +10159,7 @@ and the second line is the name of label id 1, > etc. > The label id is considered as name if the label file is not provided. > > @item backend_configs > +@item options options is old and not direct for meaning, and we prefer the new better name backend_configs. > Set the configs to be passed into backend > > @item async > @@ -10214,6 +10215,10 @@ Set the input name of the dnn network. > @item output > Set the output name of the dnn network. > > +@item backend_configs > +@item options > +Set the configs to be passed into backend > + > @item async > use DNN async execution if set (default: set), > roll back to sync execution if the backend does not support async. > @@ -18905,6 +18910,10 @@ Note that different backends use different > file formats. TensorFlow backend > can load files for both formats, while native backend can load files for > only > its format. > > +@item backend_configs > +@item options > +Set the configs to be passed into backend > + > @item scale_factor > Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} > and @code{4}. > Default value is @code{2}. Scale factor is necessary for SRCNN model, > because it accepts > -- > 1.8.3.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 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/6] avfilter/vf_sr: add options for backend configs
On Tue, Apr 27, 2021 at 02:27:48AM +, Guo, Yejun wrote: > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > lance.lmw...@gmail.com > > Sent: 2021年4月26日 18:49 > > To: ffmpeg-devel@ffmpeg.org > > Cc: Limin Wang > > Subject: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_sr: add options for backend > > configs > > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavfilter/vf_sr.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c > > index 45f941a..282c468 100644 > > --- a/libavfilter/vf_sr.c > > +++ b/libavfilter/vf_sr.c > > @@ -55,6 +55,8 @@ static const AVOption sr_options[] = { > > { "model", "path to model file specifying network architecture and its > > parameters", OFFSET(dnnctx.model_filename), AV_OPT_TYPE_STRING, > > {.str=NULL}, 0, 0, FLAGS }, > > { "input", "input name of the model", > > OFFSET(dnnctx.model_inputname), AV_OPT_TYPE_STRING,{ .str = > > "x" }, 0, 0, FLAGS }, > > { "output", "output name of the model", > > OFFSET(dnnctx.model_outputname), AV_OPT_TYPE_STRING,{ .str = > > "y" }, 0, 0, FLAGS }, > > +{ "backend_configs","backend configs", > > OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = > > NULL }, 0, 0, FLAGS }, > > +{ "options","backend configs", > > OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = > > NULL }, 0, 0, FLAGS }, > > { NULL } > > }; > > > > vf_dnn_processing.c is designed to cover all the cases for image/video > processing with M inputs and N outputs (currently only M=1 and N=1 is > supported), covering the features of vf_sr.c and vf_derain.c. To avoid > duplicate/similar code in different filters, we don't add more feature in > vf_sr.c/vf_derain.c, we just keep supporting their current feature. The problem is when trying with SRCNN model with vf_sr, I can't find scale_factor for dnn_processing, so I had to use the old vf_sr still. That's why I had to make the options be configured for vf_sr like dnn_processing. Or it's easy to get "out of memory" with default sess_config for TF. > > ___ > 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". -- Thanks, Limin Wang ___ 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/6] doc/filters: documentation to options for backend
On Tue, Apr 27, 2021 at 02:40:06AM +, Guo, Yejun wrote: > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > lance.lmw...@gmail.com > > Sent: 2021年4月26日 18:49 > > To: ffmpeg-devel@ffmpeg.org > > Cc: Limin Wang > > Subject: [FFmpeg-devel] [PATCH 3/6] doc/filters: documentation to options > > for backend > > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > doc/filters.texi | 9 + > > 1 file changed, 9 insertions(+) > > > > diff --git a/doc/filters.texi b/doc/filters.texi > > index e99d70a..a959127 100644 > > --- a/doc/filters.texi > > +++ b/doc/filters.texi > > @@ -10159,6 +10159,7 @@ and the second line is the name of label id 1, > > etc. > > The label id is considered as name if the label file is not provided. > > > > @item backend_configs > > +@item options > > options is old and not direct for meaning, and we prefer the new better > name backend_configs. Both of the options are using in the code still, so I'm glad to document them. If we prefer to backend_configs, it's better to mark the options out of date in the code. > > > Set the configs to be passed into backend > > > > @item async > > @@ -10214,6 +10215,10 @@ Set the input name of the dnn network. > > @item output > > Set the output name of the dnn network. > > > > +@item backend_configs > > +@item options > > +Set the configs to be passed into backend > > + > > @item async > > use DNN async execution if set (default: set), > > roll back to sync execution if the backend does not support async. > > @@ -18905,6 +18910,10 @@ Note that different backends use different > > file formats. TensorFlow backend > > can load files for both formats, while native backend can load files for > > only > > its format. > > > > +@item backend_configs > > +@item options > > +Set the configs to be passed into backend > > + > > @item scale_factor > > Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} > > and @code{4}. > > Default value is @code{2}. Scale factor is necessary for SRCNN model, > > because it accepts > > -- > > 1.8.3.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 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". -- Thanks, Limin Wang ___ 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/6] doc/filters: documentation to options for backend
> -Original Message- > From: ffmpeg-devel On Behalf Of > lance.lmw...@gmail.com > Sent: 2021年4月27日 11:36 > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH 3/6] doc/filters: documentation to > options for backend > > On Tue, Apr 27, 2021 at 02:40:06AM +, Guo, Yejun wrote: > > > > > > > -Original Message- > > > From: ffmpeg-devel On Behalf Of > > > lance.lmw...@gmail.com > > > Sent: 2021年4月26日 18:49 > > > To: ffmpeg-devel@ffmpeg.org > > > Cc: Limin Wang > > > Subject: [FFmpeg-devel] [PATCH 3/6] doc/filters: documentation to > options > > > for backend > > > > > > From: Limin Wang > > > > > > Signed-off-by: Limin Wang > > > --- > > > doc/filters.texi | 9 + > > > 1 file changed, 9 insertions(+) > > > > > > diff --git a/doc/filters.texi b/doc/filters.texi > > > index e99d70a..a959127 100644 > > > --- a/doc/filters.texi > > > +++ b/doc/filters.texi > > > @@ -10159,6 +10159,7 @@ and the second line is the name of label id > 1, > > > etc. > > > The label id is considered as name if the label file is not provided. > > > > > > @item backend_configs > > > +@item options > > > > options is old and not direct for meaning, and we prefer the new better > > name backend_configs. > > Both of the options are using in the code still, so I'm glad to document > them. > If we prefer to backend_configs, it's better to mark the options out of date > in the code. > yes, could you help to send a patch for it, thanks. ___ 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/adtsenc: clarify option help
On 2021-04-26 21:46, Gyan Doshi wrote: Will apply tomorrow. Pushed as 45fc214ebfcdf36b935632edda54aee9e8745550 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".
Re: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_sr: add options for backend configs
> -Original Message- > From: ffmpeg-devel On Behalf Of > lance.lmw...@gmail.com > Sent: 2021年4月27日 11:29 > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_sr: add options for > backend configs > > On Tue, Apr 27, 2021 at 02:27:48AM +, Guo, Yejun wrote: > > > > > > > -Original Message- > > > From: ffmpeg-devel On Behalf Of > > > lance.lmw...@gmail.com > > > Sent: 2021年4月26日 18:49 > > > To: ffmpeg-devel@ffmpeg.org > > > Cc: Limin Wang > > > Subject: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_sr: add options for > backend > > > configs > > > > > > From: Limin Wang > > > > > > Signed-off-by: Limin Wang > > > --- > > > libavfilter/vf_sr.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c > > > index 45f941a..282c468 100644 > > > --- a/libavfilter/vf_sr.c > > > +++ b/libavfilter/vf_sr.c > > > @@ -55,6 +55,8 @@ static const AVOption sr_options[] = { > > > { "model", "path to model file specifying network architecture > and its > > > parameters", OFFSET(dnnctx.model_filename), AV_OPT_TYPE_STRING, > > > {.str=NULL}, 0, 0, FLAGS }, > > > { "input", "input name of the model", > > > OFFSET(dnnctx.model_inputname), AV_OPT_TYPE_STRING,{ .str > = > > > "x" }, 0, 0, FLAGS }, > > > { "output", "output name of the model", > > > OFFSET(dnnctx.model_outputname), AV_OPT_TYPE_STRING,{ .str = > > > "y" }, 0, 0, FLAGS }, > > > +{ "backend_configs","backend configs", > > > OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = > > > NULL }, 0, 0, FLAGS }, > > > +{ "options","backend configs", > > > OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = > > > NULL }, 0, 0, FLAGS }, > > > { NULL } > > > }; > > > > > > > vf_dnn_processing.c is designed to cover all the cases for image/video > > processing with M inputs and N outputs (currently only M=1 and N=1 is > > supported), covering the features of vf_sr.c and vf_derain.c. To avoid > > duplicate/similar code in different filters, we don't add more feature in > > vf_sr.c/vf_derain.c, we just keep supporting their current feature. > > The problem is when trying with SRCNN model with vf_sr, I can't find > scale_factor > for dnn_processing, so I had to use the old vf_sr still. For SRCNN, we can use dnn_processing like: scale=w=iw*2:h=ih*2,dnn_processing=... ___ 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 5/6] avfilter/dnn/dnn_backend_tf: simplify the code with ff_hex_to_data
> -Original Message- > From: ffmpeg-devel On Behalf Of > lance.lmw...@gmail.com > Sent: 2021年4月26日 18:49 > To: ffmpeg-devel@ffmpeg.org > Cc: Limin Wang > Subject: [FFmpeg-devel] [PATCH 5/6] avfilter/dnn/dnn_backend_tf: simplify > the code with ff_hex_to_data > > From: Limin Wang > > please use tools/python/tf_sess_config.py to get the sess_config after that. > note the byte order of session config is the normal order. > > Signed-off-by: Limin Wang > --- > libavfilter/dnn/dnn_backend_tf.c | 34 ++ > 1 file changed, 6 insertions(+), 28 deletions(-) > > diff --git a/libavfilter/dnn/dnn_backend_tf.c > b/libavfilter/dnn/dnn_backend_tf.c > index fb799d2..0084157 100644 > --- a/libavfilter/dnn/dnn_backend_tf.c > +++ b/libavfilter/dnn/dnn_backend_tf.c > @@ -28,6 +28,7 @@ > #include "dnn_backend_native_layer_conv2d.h" > #include "dnn_backend_native_layer_depth2space.h" > #include "libavformat/avio.h" > +#include "libavformat/internal.h" > #include "libavutil/avassert.h" > #include "../internal.h" > #include "dnn_backend_native_layer_pad.h" > @@ -202,35 +203,21 @@ static DNNReturnType load_tf_model(TFModel > *tf_model, const char *model_filename > TF_SessionOptions *sess_opts; > const TF_Operation *init_op; > uint8_t *sess_config = NULL; > -int sess_config_length = 0; > +int sess_config_length = ff_hex_to_data(NULL, > tf_model->ctx.options.sess_config + 2); > > // prepare the sess config data > if (tf_model->ctx.options.sess_config != NULL) { > /* > tf_model->ctx.options.sess_config is hex to present the > serialized proto > required by TF_SetConfig below, so we need to first generate > the serialized > -proto in a python script, the following is a script example to > generate > -serialized proto which specifies one GPU, we can change the > script to add > -more options. > - > -import tensorflow as tf > -gpu_options = tf.GPUOptions(visible_device_list='0') > -config = tf.ConfigProto(gpu_options=gpu_options) > -s = config.SerializeToString() > -b = ''.join("%02x" % int(ord(b)) for b in s[::-1]) > -print('0x%s' % b) > - > -the script output looks like: 0xab...cd, and then pass 0xab...cd to > sess_config. > +proto in a python script, tools/python/tf_sess_config.py is a > script example > +to generate the configs of sess_config. > */ > -char tmp[3]; > -tmp[2] = '\0'; > - > if (strncmp(tf_model->ctx.options.sess_config, "0x", 2) != 0) { > av_log(ctx, AV_LOG_ERROR, "sess_config should start with > '0x'\n"); > return DNN_ERROR; > } there are two '+2' to skip "0x" in the code, we'd better to unify here after "0x" checking like: // skip "0x" const char *config = tf_model->ctx.options.sess_config + 2; sess_config_length = ff_hex_to_data(NULL, config); ... > > -sess_config_length = strlen(tf_model->ctx.options.sess_config); > if (sess_config_length % 2 != 0) { > av_log(ctx, AV_LOG_ERROR, "the length of sess_config is > not even (%s), " >"please re-generate the > config.\n", > @@ -238,21 +225,12 @@ static DNNReturnType load_tf_model(TFModel > *tf_model, const char *model_filename > return DNN_ERROR; > } > > -sess_config_length -= 2; //ignore the first '0x' > -sess_config_length /= 2; //get the data length in byte > - > -sess_config = av_malloc(sess_config_length); > +sess_config = av_mallocz(sess_config_length + > AV_INPUT_BUFFER_PADDING_SIZE); > if (!sess_config) { > av_log(ctx, AV_LOG_ERROR, "failed to allocate memory\n"); > return DNN_ERROR; > } > - > -for (int i = 0; i < sess_config_length; i++) { > -int index = 2 + (sess_config_length - 1 - i) * 2; > -tmp[0] = tf_model->ctx.options.sess_config[index]; > -tmp[1] = tf_model->ctx.options.sess_config[index + 1]; > -sess_config[i] = strtol(tmp, NULL, 16); > -} > +ff_hex_to_data(sess_config, tf_model->ctx.options.sess_config + > 2); > } > > graph_def = read_graph(model_filename); > -- > 1.8.3.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 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 4/6] tools/python: add help script to get sess_config
> -Original Message- > From: ffmpeg-devel On Behalf Of > lance.lmw...@gmail.com > Sent: 2021年4月26日 18:49 > To: ffmpeg-devel@ffmpeg.org > Cc: Limin Wang > Subject: [FFmpeg-devel] [PATCH 4/6] tools/python: add help script to get > sess_config > > From: Limin Wang > > Please note the byte order of the hex data is in normal order. > > Signed-off-by: Limin Wang > --- > tools/python/tf_sess_config.py | 44 > ++ > 1 file changed, 44 insertions(+) > create mode 100644 tools/python/tf_sess_config.py > > diff --git a/tools/python/tf_sess_config.py b/tools/python/tf_sess_config.py > new file mode 100644 > index 000..e4e38bd > --- /dev/null > +++ b/tools/python/tf_sess_config.py > @@ -0,0 +1,44 @@ this patch changes the order in current implementation, we'd better merge patch 4 and patch 5 in a single patch, to adjust the order in one patch. ___ 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 4/6] tools/python: add help script to get sess_config
> -Original Message- > From: Guo, Yejun > Sent: 2021年4月27日 12:11 > To: FFmpeg development discussions and patches > > Subject: RE: [FFmpeg-devel] [PATCH 4/6] tools/python: add help script to > get sess_config > > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > lance.lmw...@gmail.com > > Sent: 2021年4月26日 18:49 > > To: ffmpeg-devel@ffmpeg.org > > Cc: Limin Wang > > Subject: [FFmpeg-devel] [PATCH 4/6] tools/python: add help script to get > > sess_config > > > > From: Limin Wang > > > > Please note the byte order of the hex data is in normal order. > > > > Signed-off-by: Limin Wang > > --- > > tools/python/tf_sess_config.py | 44 > > ++ > > 1 file changed, 44 insertions(+) > > create mode 100644 tools/python/tf_sess_config.py > > > > diff --git a/tools/python/tf_sess_config.py > b/tools/python/tf_sess_config.py > > new file mode 100644 > > index 000..e4e38bd > > --- /dev/null > > +++ b/tools/python/tf_sess_config.py > > @@ -0,0 +1,44 @@ > > this patch changes the order in current implementation, we'd better > merge patch 4 and patch 5 in a single patch, to adjust the order in one > patch. and, we may remove '0x' at the beginning of value, since it is no longer a hex value in math. It is the byte order. ___ 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] [RFC PATCH] ffmpeg_videotoolbox: skip memory copy if hwaccel_output_format match
From: zhilizhao Simple test results: Command: ./ffmpeg -y -hwaccel videotoolbox -hwaccel_output_format videotoolbox_vld \ -i test.mp4 -an -c:v h264_videotoolbox -benchmark out.mp4 Before: frame= 1221 fps= 66 q=-0.0 Lsize=3144kB time=00:00:20.33 bitrate=1266.6kbits/s dup=4 drop=0 speed= 1.1x bench: utime=2.714s stime=1.218s rtime=18.574s After: frame= 1221 fps=137 q=-0.0 Lsize=3144kB time=00:00:20.33 bitrate=1266.4kbits/s dup=4 drop=0 speed=2.28x bench: utime=1.450s stime=1.440s rtime=8.924s It has limited usecase since there is no video filter support, so a log message is added to notify the user. --- It has a good performance with limited usecases like transcoding without autoscale/autorotate, and I don't know if it break some special usecase, since the RFC. fftools/ffmpeg_videotoolbox.c | 8 1 file changed, 8 insertions(+) diff --git a/fftools/ffmpeg_videotoolbox.c b/fftools/ffmpeg_videotoolbox.c index a6b78d0f7d..4ba8618539 100644 --- a/fftools/ffmpeg_videotoolbox.c +++ b/fftools/ffmpeg_videotoolbox.c @@ -29,6 +29,7 @@ typedef struct VTContext { AVFrame *tmp_frame; +int log_once; } VTContext; char *videotoolbox_pixfmt; @@ -44,6 +45,13 @@ static int videotoolbox_retrieve_data(AVCodecContext *s, AVFrame *frame) int linesize[4] = { 0 }; int planes, ret, i; +if (frame->format == ist->hwaccel_output_format) { +av_log_once(s, AV_LOG_INFO, AV_LOG_TRACE, &vt->log_once, +"There is no video filter for videotoolbox pix_fmt now, remove the " +"-hwaccel_output_format option if video filter doesn't work\n"); +return 0; +} + av_frame_unref(vt->tmp_frame); switch (pixel_format) { -- 2.31.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".
Re: [FFmpeg-devel] [PATCH 3/6] doc/filters: documentation to options for backend
On Tue, Apr 27, 2021 at 03:51:34AM +, Guo, Yejun wrote: > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > lance.lmw...@gmail.com > > Sent: 2021年4月27日 11:36 > > To: ffmpeg-devel@ffmpeg.org > > Subject: Re: [FFmpeg-devel] [PATCH 3/6] doc/filters: documentation to > > options for backend > > > > On Tue, Apr 27, 2021 at 02:40:06AM +, Guo, Yejun wrote: > > > > > > > > > > -Original Message- > > > > From: ffmpeg-devel On Behalf Of > > > > lance.lmw...@gmail.com > > > > Sent: 2021年4月26日 18:49 > > > > To: ffmpeg-devel@ffmpeg.org > > > > Cc: Limin Wang > > > > Subject: [FFmpeg-devel] [PATCH 3/6] doc/filters: documentation to > > options > > > > for backend > > > > > > > > From: Limin Wang > > > > > > > > Signed-off-by: Limin Wang > > > > --- > > > > doc/filters.texi | 9 + > > > > 1 file changed, 9 insertions(+) > > > > > > > > diff --git a/doc/filters.texi b/doc/filters.texi > > > > index e99d70a..a959127 100644 > > > > --- a/doc/filters.texi > > > > +++ b/doc/filters.texi > > > > @@ -10159,6 +10159,7 @@ and the second line is the name of label id > > 1, > > > > etc. > > > > The label id is considered as name if the label file is not provided. > > > > > > > > @item backend_configs > > > > +@item options > > > > > > options is old and not direct for meaning, and we prefer the new better > > > name backend_configs. > > > > Both of the options are using in the code still, so I'm glad to document > > them. > > If we prefer to backend_configs, it's better to mark the options out of date > > in the code. > > > > yes, could you help to send a patch for it, thanks. OK, will send a patch later. > > ___ > 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". -- Thanks, Limin Wang ___ 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/6] avfilter/vf_sr: add options for backend configs
On Tue, Apr 27, 2021 at 03:56:22AM +, Guo, Yejun wrote: > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > lance.lmw...@gmail.com > > Sent: 2021年4月27日 11:29 > > To: ffmpeg-devel@ffmpeg.org > > Subject: Re: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_sr: add options for > > backend configs > > > > On Tue, Apr 27, 2021 at 02:27:48AM +, Guo, Yejun wrote: > > > > > > > > > > -Original Message- > > > > From: ffmpeg-devel On Behalf Of > > > > lance.lmw...@gmail.com > > > > Sent: 2021年4月26日 18:49 > > > > To: ffmpeg-devel@ffmpeg.org > > > > Cc: Limin Wang > > > > Subject: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_sr: add options for > > backend > > > > configs > > > > > > > > From: Limin Wang > > > > > > > > Signed-off-by: Limin Wang > > > > --- > > > > libavfilter/vf_sr.c | 2 ++ > > > > 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c > > > > index 45f941a..282c468 100644 > > > > --- a/libavfilter/vf_sr.c > > > > +++ b/libavfilter/vf_sr.c > > > > @@ -55,6 +55,8 @@ static const AVOption sr_options[] = { > > > > { "model", "path to model file specifying network architecture > > and its > > > > parameters", OFFSET(dnnctx.model_filename), AV_OPT_TYPE_STRING, > > > > {.str=NULL}, 0, 0, FLAGS }, > > > > { "input", "input name of the model", > > > > OFFSET(dnnctx.model_inputname), AV_OPT_TYPE_STRING,{ .str > > = > > > > "x" }, 0, 0, FLAGS }, > > > > { "output", "output name of the model", > > > > OFFSET(dnnctx.model_outputname), AV_OPT_TYPE_STRING,{ .str = > > > > "y" }, 0, 0, FLAGS }, > > > > +{ "backend_configs","backend configs", > > > > OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = > > > > NULL }, 0, 0, FLAGS }, > > > > +{ "options","backend configs", > > > > OFFSET(dnnctx.backend_options), AV_OPT_TYPE_STRING,{ .str = > > > > NULL }, 0, 0, FLAGS }, > > > > { NULL } > > > > }; > > > > > > > > > > vf_dnn_processing.c is designed to cover all the cases for image/video > > > processing with M inputs and N outputs (currently only M=1 and N=1 is > > > supported), covering the features of vf_sr.c and vf_derain.c. To avoid > > > duplicate/similar code in different filters, we don't add more feature in > > > vf_sr.c/vf_derain.c, we just keep supporting their current feature. > > > > The problem is when trying with SRCNN model with vf_sr, I can't find > > scale_factor > > for dnn_processing, so I had to use the old vf_sr still. > > For SRCNN, we can use dnn_processing like: > scale=w=iw*2:h=ih*2,dnn_processing=... thanks, I'm glad to hear about that, will try with this way. > > ___ > 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". -- Thanks, Limin Wang ___ 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 4/6] tools/python: add help script to get sess_config
On Tue, Apr 27, 2021 at 04:25:55AM +, Guo, Yejun wrote: > > > > -Original Message- > > From: Guo, Yejun > > Sent: 2021年4月27日 12:11 > > To: FFmpeg development discussions and patches > > > > Subject: RE: [FFmpeg-devel] [PATCH 4/6] tools/python: add help script to > > get sess_config > > > > > > > > > -Original Message- > > > From: ffmpeg-devel On Behalf Of > > > lance.lmw...@gmail.com > > > Sent: 2021年4月26日 18:49 > > > To: ffmpeg-devel@ffmpeg.org > > > Cc: Limin Wang > > > Subject: [FFmpeg-devel] [PATCH 4/6] tools/python: add help script to get > > > sess_config > > > > > > From: Limin Wang > > > > > > Please note the byte order of the hex data is in normal order. > > > > > > Signed-off-by: Limin Wang > > > --- > > > tools/python/tf_sess_config.py | 44 > > > ++ > > > 1 file changed, 44 insertions(+) > > > create mode 100644 tools/python/tf_sess_config.py > > > > > > diff --git a/tools/python/tf_sess_config.py > > b/tools/python/tf_sess_config.py > > > new file mode 100644 > > > index 000..e4e38bd > > > --- /dev/null > > > +++ b/tools/python/tf_sess_config.py > > > @@ -0,0 +1,44 @@ > > > > this patch changes the order in current implementation, we'd better > > merge patch 4 and patch 5 in a single patch, to adjust the order in one > > patch. I'm OK with that. I think few people have used the option yet. > > and, we may remove '0x' at the beginning of value, since it is no longer > a hex value in math. It is the byte order. For hex string, it's preferable to prefix with '0x'. > > ___ > 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". -- Thanks, Limin Wang ___ 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 4/6] tools/python: add help script to get sess_config
> -Original Message- > From: ffmpeg-devel On Behalf Of > lance.lmw...@gmail.com > Sent: 2021年4月27日 14:29 > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH 4/6] tools/python: add help script to > get sess_config > > On Tue, Apr 27, 2021 at 04:25:55AM +, Guo, Yejun wrote: > > > > > > > -Original Message- > > > From: Guo, Yejun > > > Sent: 2021年4月27日 12:11 > > > To: FFmpeg development discussions and patches > > > > > > Subject: RE: [FFmpeg-devel] [PATCH 4/6] tools/python: add help script > to > > > get sess_config > > > > > > > > > > > > > -Original Message- > > > > From: ffmpeg-devel On Behalf > Of > > > > lance.lmw...@gmail.com > > > > Sent: 2021年4月26日 18:49 > > > > To: ffmpeg-devel@ffmpeg.org > > > > Cc: Limin Wang > > > > Subject: [FFmpeg-devel] [PATCH 4/6] tools/python: add help script to > get > > > > sess_config > > > > > > > > From: Limin Wang > > > > > > > > Please note the byte order of the hex data is in normal order. > > > > > > > > Signed-off-by: Limin Wang > > > > --- > > > > tools/python/tf_sess_config.py | 44 > > > > ++ > > > > 1 file changed, 44 insertions(+) > > > > create mode 100644 tools/python/tf_sess_config.py > > > > > > > > diff --git a/tools/python/tf_sess_config.py > > > b/tools/python/tf_sess_config.py > > > > new file mode 100644 > > > > index 000..e4e38bd > > > > --- /dev/null > > > > +++ b/tools/python/tf_sess_config.py > > > > @@ -0,0 +1,44 @@ > > > > > > this patch changes the order in current implementation, we'd better > > > merge patch 4 and patch 5 in a single patch, to adjust the order in one > > > patch. > > I'm OK with that. I think few people have used the option yet. yes, but we still need to keep the patch modular. There will be misleading if people bisect the code with patch 4, without patch 5. > > > > > and, we may remove '0x' at the beginning of value, since it is no longer > > a hex value in math. It is the byte order. > > For hex string, it's preferable to prefix with '0x'. for example, '0x123' is not the value of 3+2*16+1*256, I'm afraid it is confusing. anyway, '0x' as prefix is also an option, we can output a message to explain it in python script. > > > > > ___ > > 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". > > -- > Thanks, > Limin Wang > ___ > 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 5/6] avfilter/dnn/dnn_backend_tf: simplify the code with ff_hex_to_data
On Tue, Apr 27, 2021 at 04:09:18AM +, Guo, Yejun wrote: > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > lance.lmw...@gmail.com > > Sent: 2021年4月26日 18:49 > > To: ffmpeg-devel@ffmpeg.org > > Cc: Limin Wang > > Subject: [FFmpeg-devel] [PATCH 5/6] avfilter/dnn/dnn_backend_tf: simplify > > the code with ff_hex_to_data > > > > From: Limin Wang > > > > please use tools/python/tf_sess_config.py to get the sess_config after that. > > note the byte order of session config is the normal order. > > > > Signed-off-by: Limin Wang > > --- > > libavfilter/dnn/dnn_backend_tf.c | 34 ++ > > 1 file changed, 6 insertions(+), 28 deletions(-) > > > > diff --git a/libavfilter/dnn/dnn_backend_tf.c > > b/libavfilter/dnn/dnn_backend_tf.c > > index fb799d2..0084157 100644 > > --- a/libavfilter/dnn/dnn_backend_tf.c > > +++ b/libavfilter/dnn/dnn_backend_tf.c > > @@ -28,6 +28,7 @@ > > #include "dnn_backend_native_layer_conv2d.h" > > #include "dnn_backend_native_layer_depth2space.h" > > #include "libavformat/avio.h" > > +#include "libavformat/internal.h" > > #include "libavutil/avassert.h" > > #include "../internal.h" > > #include "dnn_backend_native_layer_pad.h" > > @@ -202,35 +203,21 @@ static DNNReturnType load_tf_model(TFModel > > *tf_model, const char *model_filename > > TF_SessionOptions *sess_opts; > > const TF_Operation *init_op; > > uint8_t *sess_config = NULL; > > -int sess_config_length = 0; > > +int sess_config_length = ff_hex_to_data(NULL, > > tf_model->ctx.options.sess_config + 2); > > > > // prepare the sess config data > > if (tf_model->ctx.options.sess_config != NULL) { > > /* > > tf_model->ctx.options.sess_config is hex to present the > > serialized proto > > required by TF_SetConfig below, so we need to first generate > > the serialized > > -proto in a python script, the following is a script example to > > generate > > -serialized proto which specifies one GPU, we can change the > > script to add > > -more options. > > - > > -import tensorflow as tf > > -gpu_options = tf.GPUOptions(visible_device_list='0') > > -config = tf.ConfigProto(gpu_options=gpu_options) > > -s = config.SerializeToString() > > -b = ''.join("%02x" % int(ord(b)) for b in s[::-1]) > > -print('0x%s' % b) > > - > > -the script output looks like: 0xab...cd, and then pass 0xab...cd to > > sess_config. > > +proto in a python script, tools/python/tf_sess_config.py is a > > script example > > +to generate the configs of sess_config. > > */ > > -char tmp[3]; > > -tmp[2] = '\0'; > > - > > if (strncmp(tf_model->ctx.options.sess_config, "0x", 2) != 0) { > > av_log(ctx, AV_LOG_ERROR, "sess_config should start with > > '0x'\n"); > > return DNN_ERROR; > > } > > there are two '+2' to skip "0x" in the code, we'd better to unify here after > "0x" checking like: > > // skip "0x" > const char *config = tf_model->ctx.options.sess_config + 2; > sess_config_length = ff_hex_to_data(NULL, config); > ... > I'm OK with it. > > > > -sess_config_length = strlen(tf_model->ctx.options.sess_config); > > if (sess_config_length % 2 != 0) { > > av_log(ctx, AV_LOG_ERROR, "the length of sess_config is > > not even (%s), " > >"please re-generate the > > config.\n", > > @@ -238,21 +225,12 @@ static DNNReturnType load_tf_model(TFModel > > *tf_model, const char *model_filename > > return DNN_ERROR; > > } > > > > -sess_config_length -= 2; //ignore the first '0x' > > -sess_config_length /= 2; //get the data length in byte > > - > > -sess_config = av_malloc(sess_config_length); > > +sess_config = av_mallocz(sess_config_length + > > AV_INPUT_BUFFER_PADDING_SIZE); > > if (!sess_config) { > > av_log(ctx, AV_LOG_ERROR, "failed to allocate memory\n"); > > return DNN_ERROR; > > } > > - > > -for (int i = 0; i < sess_config_length; i++) { > > -int index = 2 + (sess_config_length - 1 - i) * 2; > > -tmp[0] = tf_model->ctx.options.sess_config[index]; > > -tmp[1] = tf_model->ctx.options.sess_config[index + 1]; > > -sess_config[i] = strtol(tmp, NULL, 16); > > -} > > +ff_hex_to_data(sess_config, tf_model->ctx.options.sess_config + > > 2); > > } > > > > graph_def = read_graph(model_filename); > > -- > > 1.8.3.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-dev