Re: [FFmpeg-devel] [PATCH v2 6/6] avcodec/libsvtav1: support constant quality mode
On Thu, Sep 23, 2021 at 09:45:48AM -0400, Christopher Degawa wrote: > On Sun, Sep 19, 2021 at 2:02 PM Christopher Degawa > wrote: > > > > > > > On Fri, Sep 17, 2021 at 9:28 PM wrote: > > > >> From: Limin Wang > >> > >> Signed-off-by: Limin Wang > >> > > As a note, I personally favor this patch over mine since I don't think > > `enable_tpl_la` is worth exposing to the user if its main role is to switch > > between crf and cqp > > > > Ping on this patch, this has been requested on SVT-AV1's side as well For Jan haven't further comments, I Will apply the patchset tomorrow unless there are objections. -- 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 v2 1/6] avcodec/libsvtav1: Fix override setting of caps_internal
On Sat, Sep 25, 2021 at 01:00:20PM +0300, Jan Ekström wrote: > On Sat, Sep 18, 2021 at 4:27 AM wrote: > > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > I'd prefer the wording "fix duplicate definition of caps_internal", > but otherwise this patch is LGTM. No problem, will update with your wording. > > Good catch. > > 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". -- 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 v2 3/6] doc: update for libsvtav1 encoder
On Sat, Sep 25, 2021 at 02:32:43PM +0300, Jan Ekström wrote: > On Sat, Sep 18, 2021 at 4:27 AM wrote: > > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > Hi, > > "doc/encoders: add available values for libsvtav1 options" > > would possibly be better as a commit message? Sure, I'll change that. > > > doc/encoders.texi | 44 > > 1 file changed, 44 insertions(+) > > > > diff --git a/doc/encoders.texi b/doc/encoders.texi > > index 8fccd73..64d604e 100644 > > --- a/doc/encoders.texi > > +++ b/doc/encoders.texi > > @@ -1750,12 +1750,56 @@ You need to explicitly configure the build with > > @code{--enable-libsvtav1}. > > @table @option > > @item profile > > Set the encoding profile. > > +@table @samp > > +@item main > > +@item high > > +@item professional > > +@end table > > > > @item level > > Set the operating point level. > > +@table @samp > > +@item 2.0 > > +@item 2.1 > > +@item 2.2 > > +@item 2.3 > > +@item 3.0 > > +@item 3.1 > > +@item 3.2 > > +@item 3.3 > > +@item 4.0 > > +@item 4.1 > > +@item 4.2 > > +@item 4.3 > > +@item 5.0 > > +@item 5.1 > > +@item 5.2 > > +@item 5.3 > > +@item 6.0 > > +@item 6.1 > > +@item 6.2 > > +@item 6.3 > > +@item 7.0 > > +@item 7.1 > > +@item 7.2 > > +@item 7.3 > > +@end table > > + > > The levels list is somewhat long, and it's specific to AV1 and not > this encoder. I don't think we list H.264/HEVC etc levels, either? > > So I'm not 100% sure on this bit, possibly just noting "Set the > operating point level, f.ex. '4.0'." is good enough? Yes, I think it's too long also. I can update by your idea. > > > +@item hielevel > > +Set the Hierarchical prediction levels. > > +@table @samp > > +@item 3level > > +@item 4level, This is the default. > > You probably mean this to be on a separate line. Right now it ends up > as part of the entry on the list a la: ‘4level, This is the default.’ > > Noticed through the HTML documentation output (ffmpeg-codecs.html). OK, will change that > > > +@end table > > > > @item tier > > Set the operating point tier. > > +@table @samp > > +@item main > > +The main tier was designed for most applications. This is the default. > > +@item high > > +The high tier was designed for very demanding applications. > > +@end table > > > > Looking at https://aomediacodec.github.io/av1-spec/av1-spec.pdf , it > seems like the high tier only enable higher bit rates/lower > compression ratios in levels. > > I think explaining it like that is probably more understandable than > vague references for "most applications" and "very demanding > applications". Or only explaining which one is the default, as I would > expect a person who needs to set this flag to know what the tier flags > in AV1 bit stream mean. OK, will only explaining which one is the default. > > 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". -- 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 v2 4/6] avcodec/libsvtav1: Fix CQP mode doesn't work as expection
On Sat, Sep 25, 2021 at 03:06:23PM +0300, Jan Ekström wrote: > On Sat, Sep 18, 2021 at 4:27 AM wrote: > > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > Commit message should probably be something along the lines of > > """ > avcodec/libsvtav1: properly enforce CQP mode when set in wrapper > > SVT-AV1 seems to have switched their default from CQP to CRF in February, > so enforce the controlling option accordingly. > """ Sure, I'll update it by your suggestion. > > > libavcodec/libsvtav1.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c > > index 0dc25ca..b029e01 100644 > > --- a/libavcodec/libsvtav1.c > > +++ b/libavcodec/libsvtav1.c > > @@ -208,6 +208,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration > > *param, > > if (param->rate_control_mode) { > > param->max_qp_allowed = avctx->qmax; > > param->min_qp_allowed = avctx->qmin; > > +} else { > > +param->enable_tpl_la = 0; /* CQP need turn off enable_tp_la */ > > As the default changing in the underlying library has now shown us, I > think (for now) it's better to move this next to > param->rate_control_mode earlier in the function, and then do > something like: > > param->enable_tpl_la = !!param->rate_control_mode; Yes, It's better idea. I'll update by your suggestion. > > (I would have utilized param->enable_tpl_la = param->rate_control_mode > == SVTAV1_RC_MODE_CQP;` but alas SVT-AV1 does not have such > enums/defines that make such things more readable). > > This way the parameter is set correctly no matter if the default is > switched over at SVT-AV1. In the future the wrapper can be reworked so > that by default SVT-AV1's own rate control defaults are utilized, and > then if either bit rate or cqp or something like that is set, we can > start enforcing that. > > 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". -- 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 v2 5/6] avcodec/libsvtav1: Fix the max range for rc_mode
On Sat, Sep 25, 2021 at 03:14:34PM +0300, Jan Ekström wrote: > On Sat, Sep 18, 2021 at 4:27 AM wrote: > > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > Probably something like "avcodec/libsvtav1: fix value range for > rc_mode" is a bit better as a commit message? OK, will change that. > > > libavcodec/libsvtav1.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c > > index b029e01..509d92d 100644 > > --- a/libavcodec/libsvtav1.c > > +++ b/libavcodec/libsvtav1.c > > @@ -522,7 +522,7 @@ static const AVOption options[] = { > > #undef LEVEL > > > > { "rc", "Bit rate control mode", OFFSET(rc_mode), > > - AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, VE , "rc"}, > > + AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, VE , "rc"}, > > And here we have another example of why bare numbers are bad :) . > Thanks for catching this. > > 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". -- 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 v2 1/6] avcodec/libsvtav1: Fix override setting of caps_internal
On Sat, Sep 25, 2021 at 03:59:20PM +0300, Jan Ekström wrote: > On Sat, Sep 25, 2021 at 3:49 PM wrote: > > > > On Sat, Sep 25, 2021 at 01:00:20PM +0300, Jan Ekström wrote: > > > On Sat, Sep 18, 2021 at 4:27 AM wrote: > > > > > > > > From: Limin Wang > > > > > > > > Signed-off-by: Limin Wang > > > > > > I'd prefer the wording "fix duplicate definition of caps_internal", > > > but otherwise this patch is LGTM. > > > > No problem, will update with your wording. > > > > For the record, those where the only comment is regarding the commit > message, I think it's at this point fair to just pull those in, so we > can make this patch set smaller on the ML :) . Sure, I'll applied patch 1,2,5, other patchset will update for reviewing > > 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". -- 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 v2 6/6] avcodec/libsvtav1: support constant quality mode
On Sat, Sep 25, 2021 at 03:35:53PM +0300, Jan Ekström wrote: > On Thu, Sep 23, 2021 at 6:08 PM wrote: > > > > On Thu, Sep 23, 2021 at 05:11:49PM +0300, Jan Ekström wrote: > > > On Thu, Sep 23, 2021 at 4:46 PM Christopher Degawa > > > wrote: > > > > > > > > On Sun, Sep 19, 2021 at 2:02 PM Christopher Degawa > > > > wrote: > > > > > > > > > > > > > > > > > > > On Fri, Sep 17, 2021 at 9:28 PM wrote: > > > > > > > > > >> From: Limin Wang > > > > >> > > > > >> Signed-off-by: Limin Wang > > > > >> > > > > > As a note, I personally favor this patch over mine since I don't think > > > > > `enable_tpl_la` is worth exposing to the user if its main role is to > > > > > switch > > > > > between crf and cqp > > > > > > > > > > > > > Ping on this patch, this has been requested on SVT-AV1's side as well > > > > > > I think my further comments on the previous version were mostly to > > > move off from the rc option for rate control, which has become more > > > and more seemingly unnecessary (and different from most other encoders > > > for no obvious reason). > > > > > > The only option that with a quick look doesn't match just setting > > > quantizer|bit rate|CRF is "cvbr", but it doesn't seem to be impossible > > > to either rework "rc" for it, or to utilize a separate option for it. > > > > Do you think it's OK to remove the rc option? to match other encoders, > > We can choose the rate control by the related parameters like: > > > > if (crf >= 0) > > choose crf rate control; > > else if (bitrate > 0) > > choose cvbr rate control; > > else if (cqp >=0 ) > > choose cqp rate control; > > > > In general that is the idea, yes (except bit rate would mean either > vbr or cvbr). It would be nice to follow whatever is the default on > SVT-AV1's side by default, and then if the user specifies a rate > control mode that is not the default, his selection is honored. Not > sure what the best way for that is to be honest. Possibly the style of > setting AVCodecDefault a la libx265? > > For the rc option, given how much SVT-AV1 itself is in flux, I would > be OK with removing the option, or making it an option that decides > between cvbr and vbr (essentially making it "VBR bit rate control > mode"). I wish cvbr would instead be something like VBV/HRD elsewhere, > so we could just utilize maxrate&bufsize for controlling it, instead > of having it as another discrete rate control mode. Yes, I think it's preferable to use utilize maxrate&bufsize to control cbr and vbr as most of encoder. Then I'll follow this direction to update the patch. > > As these things change, I also hope that SVT-AV1 will soon get a > key=value style of option API, that way the wrapper will not have to > be updated constantly according to the changes in the library :) . As > I feel SVT-AV1 will be changed quite a bit in the future (due to its > recent age). > Yes, it's good to add svtav1-opts so that we can utilize the update options directly. > 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". -- 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] [PATCH v3 1/2] doc/encoders: add available values for libsvtav1 options
From: Limin Wang Signed-off-by: Limin Wang --- doc/encoders.texi | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 8fccd73..8a7589c 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1750,12 +1750,30 @@ You need to explicitly configure the build with @code{--enable-libsvtav1}. @table @option @item profile Set the encoding profile. +@table @samp +@item main +@item high +@item professional +@end table @item level -Set the operating point level. +Set the operating point level. For example: '4.0' + +@item hielevel +Set the Hierarchical prediction levels. +@table @samp +@item 3level +@item 4level +This is the default. +@end table @item tier Set the operating point tier. +@table @samp +@item main +This is the default. +@item high +@end table @item rc Set the rate control mode to use. -- 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 v3 2/2] avcodec/libsvtav1: properly enforce CQP mode when set in wrapper
From: Limin Wang SVT-AV1 seems to have switched their default from CQP to CRF in February, so enforce the controlling option accordingly. Signed-off-by: Limin Wang --- libavcodec/libsvtav1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index a02ba6a..6196da2 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -205,6 +205,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame; } +param->enable_tpl_la = !!param->rate_control_mode; if (param->rate_control_mode) { param->max_qp_allowed = avctx->qmax; param->min_qp_allowed = avctx->qmin; -- 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 v2 6/6] avcodec/libsvtav1: support constant quality mode
On Sat, Sep 25, 2021 at 04:51:58PM +0300, Jan Ekström wrote: > On Sat, Sep 25, 2021 at 4:35 PM wrote: > > > > On Sat, Sep 25, 2021 at 03:35:53PM +0300, Jan Ekström wrote: > > > On Thu, Sep 23, 2021 at 6:08 PM wrote: > > > > > > > > On Thu, Sep 23, 2021 at 05:11:49PM +0300, Jan Ekström wrote: > > > > > On Thu, Sep 23, 2021 at 4:46 PM Christopher Degawa > > > > > wrote: > > > > > > > > > > > > On Sun, Sep 19, 2021 at 2:02 PM Christopher Degawa > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > On Fri, Sep 17, 2021 at 9:28 PM wrote: > > > > > > > > > > > > > >> From: Limin Wang > > > > > > >> > > > > > > >> Signed-off-by: Limin Wang > > > > > > >> > > > > > > > As a note, I personally favor this patch over mine since I don't > > > > > > > think > > > > > > > `enable_tpl_la` is worth exposing to the user if its main role is > > > > > > > to switch > > > > > > > between crf and cqp > > > > > > > > > > > > > > > > > > > Ping on this patch, this has been requested on SVT-AV1's side as > > > > > > well > > > > > > > > > > I think my further comments on the previous version were mostly to > > > > > move off from the rc option for rate control, which has become more > > > > > and more seemingly unnecessary (and different from most other encoders > > > > > for no obvious reason). > > > > > > > > > > The only option that with a quick look doesn't match just setting > > > > > quantizer|bit rate|CRF is "cvbr", but it doesn't seem to be impossible > > > > > to either rework "rc" for it, or to utilize a separate option for it. > > > > > > > > Do you think it's OK to remove the rc option? to match other encoders, > > > > We can choose the rate control by the related parameters like: > > > > > > > > if (crf >= 0) > > > > choose crf rate control; > > > > else if (bitrate > 0) > > > > choose cvbr rate control; > > > > else if (cqp >=0 ) > > > > choose cqp rate control; > > > > > > > > > > In general that is the idea, yes (except bit rate would mean either > > > vbr or cvbr). It would be nice to follow whatever is the default on > > > SVT-AV1's side by default, and then if the user specifies a rate > > > control mode that is not the default, his selection is honored. Not > > > sure what the best way for that is to be honest. Possibly the style of > > > setting AVCodecDefault a la libx265? > > > > > > For the rc option, given how much SVT-AV1 itself is in flux, I would > > > be OK with removing the option, or making it an option that decides > > > between cvbr and vbr (essentially making it "VBR bit rate control > > > mode"). I wish cvbr would instead be something like VBV/HRD elsewhere, > > > so we could just utilize maxrate&bufsize for controlling it, instead > > > of having it as another discrete rate control mode. > > > > Yes, I think it's preferable to use utilize maxrate&bufsize to control > > cbr and vbr as most of encoder. Then I'll follow this direction to update > > the patch. > > > > Unfortunately that was just wishful thinking :) . > > Unless you can set the buffer size and max rate in SVT-AV1, of course. > With the limited looking I've done CVBR just uses the bit rate for > each GOP instead of average over the whole clip. As it's not very clear yet, so I'll not update this patch anymore. > > > > > > > As these things change, I also hope that SVT-AV1 will soon get a > > > key=value style of option API, that way the wrapper will not have to > > > be updated constantly according to the changes in the library :) . As > > > I feel SVT-AV1 will be changed quite a bit in the future (due to its > > > recent age). > > > > > > > Yes, it's good to add svtav1-opts so that we can utilize the update options > > directly. > > > > Let's go with -params ;) Since that is what modules seem to have > standardized on (x264|x265|rav1e|aom) :) > > But that is anyways in the future, since SVT-AV1 doesn't have such an > API yet (as far as I know). I think I have tried to add new options half year again, there are willing to hold and let to wait for the params API. > > 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". -- 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/5] avfilter/vf_codecview: added new options for block
On Tue, Sep 21, 2021 at 12:32:02PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > doc/filters.texi | 3 +++ > libavfilter/version.h | 2 +- > libavfilter/vf_codecview.c | 35 +++ > 3 files changed, 39 insertions(+), 1 deletion(-) > > diff --git a/doc/filters.texi b/doc/filters.texi > index 9416100..9caaf4d 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -8152,6 +8152,9 @@ means. For example, some MPEG based codecs export > motion vectors through the > The filter accepts the following option: > > @table @option > +@item block > +Display block partition structure using the luma plane. > + > @item mv > Set motion vectors to visualize. > > diff --git a/libavfilter/version.h b/libavfilter/version.h > index 24b59ac..2688679 100644 > --- a/libavfilter/version.h > +++ b/libavfilter/version.h > @@ -31,7 +31,7 @@ > > #define LIBAVFILTER_VERSION_MAJOR 8 > #define LIBAVFILTER_VERSION_MINOR 9 > -#define LIBAVFILTER_VERSION_MICRO 100 > +#define LIBAVFILTER_VERSION_MICRO 101 > > > #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ > diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c > index dc3d3ac..4a2766a 100644 > --- a/libavfilter/vf_codecview.c > +++ b/libavfilter/vf_codecview.c > @@ -32,6 +32,7 @@ > #include "libavutil/imgutils.h" > #include "libavutil/motion_vector.h" > #include "libavutil/opt.h" > +#include "libavutil/video_enc_params.h" > #include "avfilter.h" > #include "qp_table.h" > #include "internal.h" > @@ -52,6 +53,7 @@ typedef struct CodecViewContext { > unsigned mv_type; > int hsub, vsub; > int qp; > +int block; > } CodecViewContext; > > #define OFFSET(x) offsetof(CodecViewContext, x) > @@ -73,6 +75,7 @@ static const AVOption codecview_options[] = { > CONST("if", "I-frames", FRAME_TYPE_I, "frame_type"), > CONST("pf", "P-frames", FRAME_TYPE_P, "frame_type"), > CONST("bf", "B-frames", FRAME_TYPE_B, "frame_type"), > +{ "block", "set block partitioning structure to visualize", > OFFSET(block), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, > { NULL } > }; > > @@ -210,6 +213,21 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int > ex, > draw_line(buf, sx, sy, ex, ey, w, h, stride, color); > } > > +static void draw_block_rectangle(uint8_t *buf, int sx, int sy, int w, int h, > int stride, int color) > +{ > +for (int x = sx; x < sx + w; x++) > +buf[x] = color; > + > +for (int y = sy; y < sy + h; y++) { > +buf[sx] = color; > +buf[sx + w - 1] = color; > +buf += stride; > +} > + > +for (int x = sx; x < sx + w; x++) > +buf[x] = color; > +} > + > static int filter_frame(AVFilterLink *inlink, AVFrame *frame) > { > AVFilterContext *ctx = inlink->dst; > @@ -247,6 +265,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > *frame) > av_freep(&qp_table); > } > > +if (s->block) { > +AVFrameSideData *sd = av_frame_get_side_data(frame, > AV_FRAME_DATA_VIDEO_ENC_PARAMS); > +if (sd) { > +AVVideoEncParams *par = (AVVideoEncParams*)sd->data; > +const int stride = frame->linesize[0]; > + > +if (par->nb_blocks) { > +for (int block_idx = 0; block_idx < par->nb_blocks; > block_idx++) { > +AVVideoBlockParams *b = av_video_enc_params_block(par, > block_idx); > +uint8_t *buf = frame->data[0] + b->src_y * stride; > + > +draw_block_rectangle(buf, b->src_x, b->src_y, b->w, > b->h, stride, 100); > +} > +} > +} > +} > + > if (s->mv || s->mv_type) { > AVFrameSideData *sd = av_frame_get_side_data(frame, > AV_FRAME_DATA_MOTION_VECTORS); > if (sd) { > -- > 1.8.3.1 > ping. will apply the rest of patchset(1,3,4,5) tomorrow unless there are objection. -- 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] [PATCH 1/4] avutil/detection_bbox: fix the memory leak on error
From: Limin Wang Signed-off-by: Limin Wang --- libavutil/detection_bbox.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c index 40711e6..d066567 100644 --- a/libavutil/detection_bbox.c +++ b/libavutil/detection_bbox.c @@ -61,6 +61,7 @@ AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32 } if (!av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_DETECTION_BBOXES, buf)) { +av_freep(&header); av_buffer_unref(&buf); return 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 2/4] avutil/detection_bbox: use offsetof for bboxes_offset
From: Limin Wang Signed-off-by: Limin Wang --- libavutil/detection_bbox.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c index d066567..8bfdff7 100644 --- a/libavutil/detection_bbox.c +++ b/libavutil/detection_bbox.c @@ -21,10 +21,11 @@ AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size) { size_t size; -struct { +struct BBoxContext { AVDetectionBBoxHeader header; AVDetectionBBox boxes[1]; } *ret; +const size_t bboxes_offset = offsetof(struct BBoxContext, boxes); size = sizeof(*ret); if (nb_bboxes - 1 > (SIZE_MAX - size) / sizeof(*ret->boxes)) @@ -37,7 +38,7 @@ AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_s ret->header.nb_bboxes = nb_bboxes; ret->header.bbox_size = sizeof(*ret->boxes); -ret->header.bboxes_offset = (char *)&ret->boxes - (char *)&ret->header; +ret->header.bboxes_offset = bboxes_offset; if (out_size) *out_size = size; -- 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/4] avutil/detection_bbox: simplify code for better readability
From: Limin Wang Signed-off-by: Limin Wang --- libavutil/detection_bbox.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c index 8bfdff7..3de66ce 100644 --- a/libavutil/detection_bbox.c +++ b/libavutil/detection_bbox.c @@ -23,27 +23,29 @@ AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_s size_t size; struct BBoxContext { AVDetectionBBoxHeader header; -AVDetectionBBox boxes[1]; -} *ret; +AVDetectionBBox boxes; +}; const size_t bboxes_offset = offsetof(struct BBoxContext, boxes); +const size_t bbox_size = sizeof(AVDetectionBBox); +AVDetectionBBoxHeader *header; -size = sizeof(*ret); -if (nb_bboxes - 1 > (SIZE_MAX - size) / sizeof(*ret->boxes)) +size = bboxes_offset; +if (nb_bboxes > (SIZE_MAX - size) / bbox_size) return NULL; -size += sizeof(*ret->boxes) * (nb_bboxes - 1); +size += bbox_size * nb_bboxes; -ret = av_mallocz(size); -if (!ret) +header = av_mallocz(size); +if (!header) return NULL; -ret->header.nb_bboxes = nb_bboxes; -ret->header.bbox_size = sizeof(*ret->boxes); -ret->header.bboxes_offset = bboxes_offset; +header->nb_bboxes = nb_bboxes; +header->bbox_size = bbox_size; +header->bboxes_offset = bboxes_offset; if (out_size) *out_size = size; -return &ret->header; +return header; } AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes) -- 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/4] avcodec/hevcdec: set the film grain property if present
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevcdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 57a6175..b4edb3b 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -385,6 +385,9 @@ static int export_stream_params_from_sei(HEVCContext *s) avctx->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics; } +if (s->sei.film_grain_characteristics.present) +avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN; + return 0; } -- 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 1/4] avutil/detection_bbox: fix the memory leak on error
On Tue, Sep 28, 2021 at 03:45:03PM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavutil/detection_bbox.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c > > index 40711e6..d066567 100644 > > --- a/libavutil/detection_bbox.c > > +++ b/libavutil/detection_bbox.c > > @@ -61,6 +61,7 @@ AVDetectionBBoxHeader > > *av_detection_bbox_create_side_data(AVFrame *frame, uint32 > > } > > > > if (!av_frame_new_side_data_from_buf(frame, > > AV_FRAME_DATA_DETECTION_BBOXES, buf)) { > > +av_freep(&header); > > av_buffer_unref(&buf); > > return NULL; > > } > > > > This is wrong: header is owned by buf (or rather by the underlying > AVBuffer) and will automatically be freed when the last AVBufferRef gets > unreferenced, which happens in the above av_buffer_unref() call. Your > patch will just lead to a double-free. Sorry, it's my fault, haven't notice that, please ignore the patch. > > - 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". -- 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/4] avutil/detection_bbox: simplify code for better readability
On Tue, Sep 28, 2021 at 03:57:27PM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavutil/detection_bbox.c | 24 +--- > > 1 file changed, 13 insertions(+), 11 deletions(-) > > > > diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c > > index 8bfdff7..3de66ce 100644 > > --- a/libavutil/detection_bbox.c > > +++ b/libavutil/detection_bbox.c > > @@ -23,27 +23,29 @@ AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t > > nb_bboxes, size_t *out_s > > size_t size; > > struct BBoxContext { > > AVDetectionBBoxHeader header; > > -AVDetectionBBox boxes[1]; > > -} *ret; > > +AVDetectionBBox boxes; > > +}; > > const size_t bboxes_offset = offsetof(struct BBoxContext, boxes); > > +const size_t bbox_size = sizeof(AVDetectionBBox); > > +AVDetectionBBoxHeader *header; > > > > -size = sizeof(*ret); > > -if (nb_bboxes - 1 > (SIZE_MAX - size) / sizeof(*ret->boxes)) > > This here is actually not a simplification, but a patch: The old code > would not really work if nb_bboxes == 0. OK, I'll change the comment message to "Fix the av_detection_bbox_alloc failed if nb_bboxes == 0" > > > +size = bboxes_offset; > > +if (nb_bboxes > (SIZE_MAX - size) / bbox_size) > > return NULL; > > -size += sizeof(*ret->boxes) * (nb_bboxes - 1); > > +size += bbox_size * nb_bboxes; > > > > -ret = av_mallocz(size); > > -if (!ret) > > +header = av_mallocz(size); > > +if (!header) > > return NULL; > > > > -ret->header.nb_bboxes = nb_bboxes; > > -ret->header.bbox_size = sizeof(*ret->boxes); > > -ret->header.bboxes_offset = bboxes_offset; > > +header->nb_bboxes = nb_bboxes; > > +header->bbox_size = bbox_size; > > +header->bboxes_offset = bboxes_offset; > > > > if (out_size) > > *out_size = size; > > > > -return &ret->header; > > +return header; > > } > > > > AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, > > uint32_t nb_bboxes) > > > > ___ > 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] [PATCH 1/5] avfilter/vf_showinfo: minor adjustment for the dump format of ROI
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/vf_showinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index 87c2bed..5d97ef6 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -147,10 +147,10 @@ static void dump_roi(AVFilterContext *ctx, const AVFrameSideData *sd) } nb_rois = sd->size / roi_size; -av_log(ctx, AV_LOG_INFO, "Regions Of Interest(RoI) information: "); +av_log(ctx, AV_LOG_INFO, "Regions Of Interest(ROI) information: \n"); for (int i = 0; i < nb_rois; i++) { roi = (const AVRegionOfInterest *)(sd->data + roi_size * i); -av_log(ctx, AV_LOG_INFO, "index: %d, region: (%d, %d)/(%d, %d), qp offset: %d/%d.\n", +av_log(ctx, AV_LOG_INFO, "index: %d, region: (%d, %d) -> (%d, %d), qp offset: %d/%d.\n", i, roi->left, roi->top, roi->right, roi->bottom, roi->qoffset.num, roi->qoffset.den); } } -- 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/5] avfilter/vf_addroi: realloc the buf and append new ROI
From: Limin Wang It is simpler and more efficient compared to the current code. Signed-off-by: Limin Wang --- libavfilter/vf_addroi.c | 98 +++-- 1 file changed, 37 insertions(+), 61 deletions(-) diff --git a/libavfilter/vf_addroi.c b/libavfilter/vf_addroi.c index 5f9ec21..f521a96 100644 --- a/libavfilter/vf_addroi.c +++ b/libavfilter/vf_addroi.c @@ -91,14 +91,40 @@ static int addroi_config_input(AVFilterLink *inlink) return 0; } +static int addroi_append_roi(AVBufferRef **pbuf, AVRegionOfInterest *region) +{ +AVBufferRef *buf = *pbuf; +uint32_t old_size = buf ? buf->size : 0; +int ret; +AVRegionOfInterest *roi; + +ret = av_buffer_realloc(pbuf, old_size + sizeof(*region)); +if (ret < 0) +return ret; +buf = *pbuf; + +roi = (AVRegionOfInterest *)(buf->data + old_size); +memcpy(roi, region, sizeof(*region)); + +return 0; +} + static int addroi_filter_frame(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *avctx = inlink->dst; AVFilterLink *outlink = avctx->outputs[0]; AddROIContext *ctx = avctx->priv; -AVRegionOfInterest *roi; +AVRegionOfInterest region = (AVRegionOfInterest) { +.self_size = sizeof(AVRegionOfInterest), +.top = ctx->region[Y], +.bottom= ctx->region[Y] + ctx->region[H], +.left = ctx->region[X], +.right = ctx->region[X] + ctx->region[W], +.qoffset = ctx->qoffset, +}; AVFrameSideData *sd; int err; +AVBufferRef *buf = NULL; if (ctx->clear) { av_frame_remove_side_data(frame, AV_FRAME_DATA_REGIONS_OF_INTEREST); @@ -107,73 +133,23 @@ static int addroi_filter_frame(AVFilterLink *inlink, AVFrame *frame) sd = av_frame_get_side_data(frame, AV_FRAME_DATA_REGIONS_OF_INTEREST); } if (sd) { -const AVRegionOfInterest *old_roi; -uint32_t old_roi_size; -AVBufferRef *roi_ref; -int nb_roi, i; - -old_roi = (const AVRegionOfInterest*)sd->data; -old_roi_size = old_roi->self_size; -av_assert0(old_roi_size && sd->size % old_roi_size == 0); -nb_roi = sd->size / old_roi_size + 1; - -roi_ref = av_buffer_alloc(sizeof(*roi) * nb_roi); -if (!roi_ref) { -err = AVERROR(ENOMEM); +buf = sd->buf; +err = addroi_append_roi(&buf, ®ion); +if (err < 0) goto fail; -} -roi = (AVRegionOfInterest*)roi_ref->data; - -for (i = 0; i < nb_roi - 1; i++) { -old_roi = (const AVRegionOfInterest*) -(sd->data + old_roi_size * i); - -roi[i] = (AVRegionOfInterest) { -.self_size = sizeof(*roi), -.top = old_roi->top, -.bottom= old_roi->bottom, -.left = old_roi->left, -.right = old_roi->right, -.qoffset = old_roi->qoffset, -}; -} - -roi[nb_roi - 1] = (AVRegionOfInterest) { -.self_size = sizeof(*roi), -.top = ctx->region[Y], -.bottom= ctx->region[Y] + ctx->region[H], -.left = ctx->region[X], -.right = ctx->region[X] + ctx->region[W], -.qoffset = ctx->qoffset, -}; - -av_frame_remove_side_data(frame, AV_FRAME_DATA_REGIONS_OF_INTEREST); - -sd = av_frame_new_side_data_from_buf(frame, - AV_FRAME_DATA_REGIONS_OF_INTEREST, - roi_ref); -if (!sd) { -av_buffer_unref(&roi_ref); -err = AVERROR(ENOMEM); -goto fail; -} +sd->data = buf->data; +sd->size = buf->size; } else { -sd = av_frame_new_side_data(frame, AV_FRAME_DATA_REGIONS_OF_INTEREST, -sizeof(AVRegionOfInterest)); +err = addroi_append_roi(&buf, ®ion); +if (err < 0) +goto fail; +sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_REGIONS_OF_INTEREST, buf); if (!sd) { +av_buffer_unref(&buf); err = AVERROR(ENOMEM); goto fail; } -roi = (AVRegionOfInterest*)sd->data; -*roi = (AVRegionOfInterest) { -.self_size = sizeof(*roi), -.top = ctx->region[Y], -.bottom= ctx->region[Y] + ctx->region[H], -.left = ctx->region[X], -.right = ctx->region[X] + ctx->region[W], -.qoffset = ctx->qoffset, -}; } return ff_filter_frame(outlink, frame); -- 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 "unsubscr
[FFmpeg-devel] [PATCH 3/5] avformat/libsrt: use strtoll/strtol for int64_t/int
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/libsrt.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index a80f249..5aef0e7 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -397,10 +397,10 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags) p = strchr(uri, '?'); if (p) { if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) { -s->rw_timeout = strtol(buf, NULL, 10); +s->rw_timeout = strtoll(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "listen_timeout", p)) { -s->listen_timeout = strtol(buf, NULL, 10); +s->listen_timeout = strtoll(buf, NULL, 10); } } if (s->rw_timeout >= 0) { @@ -566,19 +566,19 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) s->inputbw = strtoll(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "oheadbw", p)) { -s->oheadbw = strtoll(buf, NULL, 10); +s->oheadbw = strtol(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "latency", p)) { -s->latency = strtol(buf, NULL, 10); +s->latency = strtoll(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "tsbpddelay", p)) { -s->latency = strtol(buf, NULL, 10); +s->latency = strtoll(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "rcvlatency", p)) { -s->rcvlatency = strtol(buf, NULL, 10); +s->rcvlatency = strtoll(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "peerlatency", p)) { -s->peerlatency = strtol(buf, NULL, 10); +s->peerlatency = strtoll(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "tlpktdrop", p)) { s->tlpktdrop = strtol(buf, NULL, 10); @@ -587,7 +587,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) s->nakreport = strtol(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "connect_timeout", p)) { -s->connect_timeout = strtol(buf, NULL, 10); +s->connect_timeout = strtoll(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "payload_size", p) || av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) { -- 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/5] avformat/libsrt: specify base of maxbw string to 10 instead of auto-detect
From: Limin Wang Make all options string conversion consistent. Signed-off-by: Limin Wang --- libavformat/libsrt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index 5aef0e7..c6308d1 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -530,7 +530,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) p = strchr(uri, '?'); if (p) { if (av_find_info_tag(buf, sizeof(buf), "maxbw", p)) { -s->maxbw = strtoll(buf, NULL, 0); +s->maxbw = strtoll(buf, NULL, 10); } if (av_find_info_tag(buf, sizeof(buf), "pbkeylen", p)) { s->pbkeylen = strtol(buf, NULL, 10); -- 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/5] avformat/libsrt: add snddropdelay parameter for srt
From: Limin Wang Signed-off-by: Limin Wang --- doc/protocols.texi | 10 ++ libavformat/libsrt.c | 7 +++ 2 files changed, 17 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index 726e5f1..9c246f8 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1496,6 +1496,16 @@ when the old encryption key is decommissioned. Default is -1. -1 means auto (0x1000 in srt library). The range for this option is integers in the 0 - @code{INT_MAX}. +@item snddropdelay=@var{microseconds} +The sender's delay before dropping packets. This delay is +added to the default drop delay time interval value. +Keep in mind that the longer the delay, the more probable it +becomes that packets would be retransmitted uselessly because +they will be dropped by the receiver anyway. + +Default is -1 means auto which typically means do not drop +packets on the sender at all. + @item payload_size=@var{bytes} Sets the maximum declared size of a packet transferred during the single call to the sending function in Live diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index c6308d1..13697d2 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -65,6 +65,7 @@ typedef struct SRTContext { int enforced_encryption; int kmrefreshrate; int kmpreannounce; +int64_t snddropdelay; #endif int mss; int ffs; @@ -111,6 +112,7 @@ static const AVOption libsrt_options[] = { { "enforced_encryption", "Enforces that both connection parties have the same passphrase set", OFFSET(enforced_encryption), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, .flags = D|E }, { "kmrefreshrate", "The number of packets to be transmitted after which the encryption key is switched to a new key", OFFSET(kmrefreshrate), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { "kmpreannounce", "The interval between when a new encryption key is sent and when switchover occurs", OFFSET(kmpreannounce), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, +{ "snddropdelay","The sender's delay(in microseconds) before dropping packets", OFFSET(snddropdelay), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E }, #endif { "mss","The Maximum Segment Size", OFFSET(mss), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1500, .flags = D|E }, { "ffs","Flight flag size (window size) (in bytes)", OFFSET(ffs), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, @@ -318,6 +320,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) int latency = s->latency / 1000; int rcvlatency = s->rcvlatency / 1000; int peerlatency = s->peerlatency / 1000; +int snddropdelay = s->snddropdelay / 1000; int connect_timeout = s->connect_timeout; if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd, SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) || @@ -334,6 +337,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) #endif (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) || (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) || +(s->snddropdelay >= 0 && libsrt_setsockopt(h, fd, SRTO_SNDDROPDELAY, "SRTO_SNDDROPDELAY", &snddropdelay, sizeof(snddropdelay)) < 0) || #endif (s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MSS", &s->mss, sizeof(s->mss)) < 0) || (s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC", &s->ffs, sizeof(s->ffs)) < 0) || @@ -549,6 +553,9 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) if (av_find_info_tag(buf, sizeof(buf), "kmpreannounce", p)) { s->kmpreannounce = strtol(buf, NULL, 10); } +if (av_find_info_tag(buf, sizeof(buf), "snddropdelay", p)) { +s->snddropdelay = strtoll(buf, NULL, 10); +} #endif if (av_find_info_tag(buf, sizeof(buf), "mss", p)) { s->mss = strtol(buf, NULL, 10); -- 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 1/5] avfilter/vf_showinfo: minor adjustment for the dump format of ROI
On Thu, Sep 30, 2021 at 03:19:39AM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavfilter/vf_showinfo.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c > > index 87c2bed..5d97ef6 100644 > > --- a/libavfilter/vf_showinfo.c > > +++ b/libavfilter/vf_showinfo.c > > @@ -147,10 +147,10 @@ static void dump_roi(AVFilterContext *ctx, const > > AVFrameSideData *sd) > > } > > nb_rois = sd->size / roi_size; > > > > -av_log(ctx, AV_LOG_INFO, "Regions Of Interest(RoI) information: "); > > +av_log(ctx, AV_LOG_INFO, "Regions Of Interest(ROI) information: \n"); > ^ > Unnecessary space Yes, will remove it, thanks. > > > for (int i = 0; i < nb_rois; i++) { > > roi = (const AVRegionOfInterest *)(sd->data + roi_size * i); > > -av_log(ctx, AV_LOG_INFO, "index: %d, region: (%d, %d)/(%d, %d), qp > > offset: %d/%d.\n", > > +av_log(ctx, AV_LOG_INFO, "index: %d, region: (%d, %d) -> (%d, %d), > > qp offset: %d/%d.\n", > > i, roi->left, roi->top, roi->right, roi->bottom, > > roi->qoffset.num, roi->qoffset.den); > > } > > } > > > > ___ > 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/5] avfilter/vf_addroi: realloc the buf and append new ROI
On Thu, Sep 30, 2021 at 04:58:07AM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > It is simpler and more efficient compared to the current code. > > > > Signed-off-by: Limin Wang > > --- > > libavfilter/vf_addroi.c | 98 > > +++-- > > 1 file changed, 37 insertions(+), 61 deletions(-) > > > > diff --git a/libavfilter/vf_addroi.c b/libavfilter/vf_addroi.c > > index 5f9ec21..f521a96 100644 > > --- a/libavfilter/vf_addroi.c > > +++ b/libavfilter/vf_addroi.c > > @@ -91,14 +91,40 @@ static int addroi_config_input(AVFilterLink *inlink) > > return 0; > > } > > > > +static int addroi_append_roi(AVBufferRef **pbuf, AVRegionOfInterest > > *region) > > +{ > > +AVBufferRef *buf = *pbuf; > > +uint32_t old_size = buf ? buf->size : 0; > > +int ret; > > +AVRegionOfInterest *roi; > > + > > +ret = av_buffer_realloc(pbuf, old_size + sizeof(*region)); > > +if (ret < 0) > > +return ret; > > +buf = *pbuf; > > + > > +roi = (AVRegionOfInterest *)(buf->data + old_size); > > +memcpy(roi, region, sizeof(*region)); > > + > > +return 0; > > +} > > + > > static int addroi_filter_frame(AVFilterLink *inlink, AVFrame *frame) > > { > > AVFilterContext *avctx = inlink->dst; > > AVFilterLink *outlink = avctx->outputs[0]; > > AddROIContext *ctx = avctx->priv; > > -AVRegionOfInterest *roi; > > +AVRegionOfInterest region = (AVRegionOfInterest) { > > +.self_size = sizeof(AVRegionOfInterest), > > +.top = ctx->region[Y], > > +.bottom= ctx->region[Y] + ctx->region[H], > > +.left = ctx->region[X], > > +.right = ctx->region[X] + ctx->region[W], > > +.qoffset = ctx->qoffset, > > +}; > > AVFrameSideData *sd; > > int err; > > +AVBufferRef *buf = NULL; > > > > if (ctx->clear) { > > av_frame_remove_side_data(frame, > > AV_FRAME_DATA_REGIONS_OF_INTEREST); > > @@ -107,73 +133,23 @@ static int addroi_filter_frame(AVFilterLink *inlink, > > AVFrame *frame) > > sd = av_frame_get_side_data(frame, > > AV_FRAME_DATA_REGIONS_OF_INTEREST); > > } > > if (sd) { > > -const AVRegionOfInterest *old_roi; > > -uint32_t old_roi_size; > > -AVBufferRef *roi_ref; > > -int nb_roi, i; > > - > > -old_roi = (const AVRegionOfInterest*)sd->data; > > -old_roi_size = old_roi->self_size; > > -av_assert0(old_roi_size && sd->size % old_roi_size == 0); > > -nb_roi = sd->size / old_roi_size + 1; > > - > > -roi_ref = av_buffer_alloc(sizeof(*roi) * nb_roi); > > -if (!roi_ref) { > > -err = AVERROR(ENOMEM); > > +buf = sd->buf; > > +err = addroi_append_roi(&buf, ®ion); > > +if (err < 0) > > goto fail; > > -} > > -roi = (AVRegionOfInterest*)roi_ref->data; > > - > > -for (i = 0; i < nb_roi - 1; i++) { > > -old_roi = (const AVRegionOfInterest*) > > -(sd->data + old_roi_size * i); > > - > > -roi[i] = (AVRegionOfInterest) { > > -.self_size = sizeof(*roi), > > -.top = old_roi->top, > > -.bottom= old_roi->bottom, > > -.left = old_roi->left, > > -.right = old_roi->right, > > -.qoffset = old_roi->qoffset, > > -}; > > -} > > - > > -roi[nb_roi - 1] = (AVRegionOfInterest) { > > -.self_size = sizeof(*roi), > > -.top = ctx->region[Y], > > -.bottom= ctx->region[Y] + ctx->region[H], > > -.left = ctx->region[X], > > -.right = ctx->region[X] + ctx->region[W], > > -.qoffset = ctx->qoffset, > > -}; > > - > > -av_frame_remove_side_data(frame, > > AV_FRAME_DATA_REGIONS_OF_INTEREST); > > - > > -sd = av_frame_new_side_data_from_buf(frame, > > - > > AV_FRAME_DATA_REGIONS_OF_INTEREST, > > - roi_ref); > > -if (!sd) { > > -av_buffer_unref(&roi_ref); > > -err = AVERROR(ENOMEM); > > -goto fail; > > -} > > > > +sd->data = buf->data; > > +sd->size = buf->size; > > } else { > > -sd = av_frame_new_side_data(frame, > > AV_FRAME_DATA_REGIONS_OF_INTEREST, > > -sizeof(AVRegionOfInterest)); > > +err = addroi_append_roi(&buf, ®ion); > > +if (err < 0) > > +goto fail; > > +sd = av_frame_new_side_data_from_buf(frame, > > AV_FRAME_DATA_REGIONS_OF_INTEREST, buf); > > if (!sd) { > > +av_buffer_unref(&buf); > > err = AVERROR(ENOMEM); > > goto fail; > > } > > -roi = (AVRegionOfInterest*)sd->da
[FFmpeg-devel] [PATCH 1/8] avcodec/bitpacked: check av_buffer_ref result
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/bitpacked.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/bitpacked.c b/libavcodec/bitpacked.c index 8143151..0440df9 100644 --- a/libavcodec/bitpacked.c +++ b/libavcodec/bitpacked.c @@ -45,6 +45,10 @@ static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame, /* there is no need to copy as the data already match * a known pixel format */ frame->buf[0] = av_buffer_ref(avpkt->buf); +if (!frame->buf[0]) { +return AVERROR(ENOMEM); +} + ret = av_image_fill_arrays(frame->data, frame->linesize, avpkt->data, avctx->pix_fmt, avctx->width, avctx->height, 1); if (ret < 0) { -- 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/8] avformat/rtpdec_rfc4175: use av_get_bits_per_pixel()
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 4daff4d..e1e1452 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -43,8 +43,8 @@ struct PayloadContext { static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) { enum AVPixelFormat pixfmt = AV_PIX_FMT_NONE; -int bits_per_sample = 0; int tag = 0; +const AVPixFmtDescriptor *desc; if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { tag = MKTAG('U', 'Y', 'V', 'Y'); @@ -52,11 +52,9 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) if (data->depth == 8) { data->pgroup = 4; -bits_per_sample = 16; pixfmt = AV_PIX_FMT_UYVY422; } else if (data->depth == 10) { data->pgroup = 5; -bits_per_sample = 20; pixfmt = AV_PIX_FMT_YUV422P10; } else { return AVERROR_INVALIDDATA; @@ -65,9 +63,10 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) return AVERROR_INVALIDDATA; } +desc = av_pix_fmt_desc_get(pixfmt); stream->codecpar->format = pixfmt; stream->codecpar->codec_tag = tag; -stream->codecpar->bits_per_coded_sample = bits_per_sample; +stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); data->frame_size = data->width * data->height * data->pgroup / data->xinc; return 0; -- 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/8] avformat/rtpdec_rfc4175: Remove redundant initialization
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index e1e1452..97939b0 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -42,8 +42,8 @@ struct PayloadContext { static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) { -enum AVPixelFormat pixfmt = AV_PIX_FMT_NONE; -int tag = 0; +enum AVPixelFormat pixfmt; +int tag; const AVPixFmtDescriptor *desc; if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { -- 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/8] avformat/rtpdec_rfc4175: return the proper value
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 97939b0..46d30ed 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -105,7 +105,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index, if (!data->sampling || !data->depth || !data->width || !data->height) -return -1; +return AVERROR(EINVAL); stream->codecpar->width = data->width; stream->codecpar->height = data->height; -- 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/8] avformat/rtpdec_rfc4175: add support for exactframerate
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 46d30ed..367567d 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -25,9 +25,11 @@ #include "rtpdec_formats.h" #include "libavutil/avstring.h" #include "libavutil/pixdesc.h" +#include "libavutil/parseutils.h" struct PayloadContext { char *sampling; +char *framerate; int depth; int width; int height; @@ -45,6 +47,7 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) enum AVPixelFormat pixfmt; int tag; const AVPixFmtDescriptor *desc; +AVRational framerate; if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { tag = MKTAG('U', 'Y', 'V', 'Y'); @@ -69,6 +72,14 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); data->frame_size = data->width * data->height * data->pgroup / data->xinc; +if (data->framerate) { +if (av_parse_video_rate(&framerate, data->framerate) < 0) +return AVERROR(EINVAL); +stream->avg_frame_rate = framerate; +if (framerate.den) +stream->codecpar->bit_rate = data->frame_size * av_q2d(framerate) * 8; +} + return 0; } @@ -84,6 +95,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->sampling = av_strdup(value); else if (!strncmp(attr, "depth", 5)) data->depth = atoi(value); +else if (!strncmp(attr, "exactframerate", 14)) +data->framerate = av_strdup(value); return 0; } @@ -112,6 +125,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index, ret = rfc4175_parse_format(stream, data); av_freep(&data->sampling); +av_freep(&data->framerate); return ret; } -- 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 6/8] avformat/rtpdec_rfc4175: add support for TCS
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 367567d..db6b9b8 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -30,6 +30,7 @@ struct PayloadContext { char *sampling; char *framerate; +char *TCS; int depth; int width; int height; @@ -66,6 +67,21 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) return AVERROR_INVALIDDATA; } +if (!data->TCS) +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; +else if (!strncmp(data->TCS, "SDR", 3)) +stream->codecpar->color_trc = AVCOL_TRC_BT709; +else if (!strncmp(data->TCS, "PQ", 2)) +stream->codecpar->color_trc = AVCOL_TRC_SMPTE2084; +else if (!strncmp(data->TCS, "HLG", 3)) +stream->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67; +else if (!strncmp(data->TCS, "LINEAR", 6)) +stream->codecpar->color_trc = AVCOL_TRC_LINEAR; +else if (!strncmp(data->TCS, "ST428-1", 7)) +stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; +else if (!strncmp(data->TCS, "UNSPECIFIED", 11)) +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; + desc = av_pix_fmt_desc_get(pixfmt); stream->codecpar->format = pixfmt; stream->codecpar->codec_tag = tag; @@ -97,6 +113,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->depth = atoi(value); else if (!strncmp(attr, "exactframerate", 14)) data->framerate = av_strdup(value); +else if (!strncmp(attr, "TCS", 3)) +data->TCS = av_strdup(value); return 0; } @@ -126,6 +144,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index, ret = rfc4175_parse_format(stream, data); av_freep(&data->sampling); av_freep(&data->framerate); +av_freep(&data->TCS); return ret; } -- 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 7/8] avformat/rtpdec_rfc4175: add support for colorimetry
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index db6b9b8..23a3f4f 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -31,6 +31,7 @@ struct PayloadContext { char *sampling; char *framerate; char *TCS; +char *colorimetry; int depth; int width; int height; @@ -82,6 +83,20 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) else if (!strncmp(data->TCS, "UNSPECIFIED", 11)) stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; +if (!data->colorimetry) { +stream->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; +stream->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; +} else if (!strncmp(data->colorimetry, "BT601", 5)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT470BG; +stream->codecpar->color_space = AVCOL_SPC_BT470BG; +} else if (!strncmp(data->colorimetry, "BT709", 5)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT709; +stream->codecpar->color_space = AVCOL_SPC_BT709; +} else if (!strncmp(data->colorimetry, "BT2020", 6)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT2020; +stream->codecpar->color_space = AVCOL_SPC_BT2020_NCL; +} + desc = av_pix_fmt_desc_get(pixfmt); stream->codecpar->format = pixfmt; stream->codecpar->codec_tag = tag; @@ -115,6 +130,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->framerate = av_strdup(value); else if (!strncmp(attr, "TCS", 3)) data->TCS = av_strdup(value); +else if (!strncmp(attr, "colorimetry", 11)) +data->colorimetry = av_strdup(value); return 0; } @@ -145,6 +162,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index, av_freep(&data->sampling); av_freep(&data->framerate); av_freep(&data->TCS); +av_freep(&data->colorimetry); return ret; } -- 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 8/8] avformat/rtpdec_rfc4175: add support for RANGE
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 23a3f4f..86ffb38 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -32,6 +32,7 @@ struct PayloadContext { char *framerate; char *TCS; char *colorimetry; +char *range; int depth; int width; int height; @@ -97,6 +98,13 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) stream->codecpar->color_space = AVCOL_SPC_BT2020_NCL; } +if (!data->range) +stream->codecpar->color_range = AVCOL_RANGE_MPEG; +else if (!strncmp(data->range, "NARROW", 6)) +stream->codecpar->color_range = AVCOL_RANGE_MPEG; +else if (!strncmp(data->range, "FULL", 4)) +stream->codecpar->color_range = AVCOL_RANGE_JPEG; + desc = av_pix_fmt_desc_get(pixfmt); stream->codecpar->format = pixfmt; stream->codecpar->codec_tag = tag; @@ -132,6 +140,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->TCS = av_strdup(value); else if (!strncmp(attr, "colorimetry", 11)) data->colorimetry = av_strdup(value); +else if (!strncmp(attr, "RANGE", 5)) +data->range = av_strdup(value); return 0; } @@ -163,6 +173,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index, av_freep(&data->framerate); av_freep(&data->TCS); av_freep(&data->colorimetry); +av_freep(&data->range); return ret; } -- 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 4/4] avcodec/hevcdec: set the film grain property if present
On Tue, Sep 28, 2021 at 09:36:38PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavcodec/hevcdec.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index 57a6175..b4edb3b 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -385,6 +385,9 @@ static int export_stream_params_from_sei(HEVCContext *s) > avctx->color_trc = > s->sei.alternative_transfer.preferred_transfer_characteristics; > } > > +if (s->sei.film_grain_characteristics.present) > +avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN; > + > return 0; > } > > -- > 1.8.3.1 > will apply patch 2,3(update log message), 4 after two day unless there are any objections. -- 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] [PATCH 1/4] avcodec/audiotoolboxdec: Fix usage of init_get_bits() and use init_get_bits8()
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/audiotoolboxdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c index a222cde..9939fef 100644 --- a/libavcodec/audiotoolboxdec.c +++ b/libavcodec/audiotoolboxdec.c @@ -354,7 +354,7 @@ static av_cold int ffat_create_decoder(AVCodecContext *avctx, avctx->codec_id == AV_CODEC_ID_EAC3)) { AC3HeaderInfo hdr; GetBitContext gbc; -init_get_bits(&gbc, pkt->data, pkt->size); +init_get_bits8(&gbc, pkt->data, pkt->size); if (ff_ac3_parse_header(&gbc, &hdr) < 0) return AVERROR_INVALIDDATA; in_format.mSampleRate = hdr.sample_rate; -- 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/4] avcodec/avs3_parser: Fix usage of init_get_bits() and use init_get_bits8()
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/avs3_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c index 1a05ea0..d04d96a 100644 --- a/libavcodec/avs3_parser.c +++ b/libavcodec/avs3_parser.c @@ -73,7 +73,7 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf, GetBitContext gb; int profile, ratecode; -init_get_bits(&gb, buf + 4, buf_size - 4); +init_get_bits8(&gb, buf + 4, buf_size - 4); s->key_frame = 1; s->pict_type = AV_PICTURE_TYPE_I; -- 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/4] avcodec/mpeg12dec: Fix usage of init_get_bits() and use init_get_bits8()
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/mpeg12dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index e6ada1c..09b2902 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2265,7 +2265,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, int cc_count = 0; int i, ret; -init_get_bits(&gb, p + 2, buf_size - 2); +init_get_bits8(&gb, p + 2, buf_size - 2); cc_count = get_bits(&gb, 5); if (cc_count > 0) { int old_size = s1->a53_buf_ref ? s1->a53_buf_ref->size : 0; -- 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/4] avcodec/videotoolboxenc: use goto end for memory cleanup
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/videotoolboxenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 93c3898..bac36fd 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -876,7 +876,7 @@ static int create_cv_pixel_buffer_info(AVCodecContext* avctx, width_num = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &avctx->width); -if (!width_num) return AVERROR(ENOMEM); +if (!width_num) goto pbinfo_nomem; CFDictionarySetValue(pixel_buffer_info, kCVPixelBufferWidthKey, -- 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 5/5] avformat/libsrt: add snddropdelay parameter for srt
On Thu, Sep 30, 2021 at 09:14:00AM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > doc/protocols.texi | 10 ++ > libavformat/libsrt.c | 7 +++ > 2 files changed, 17 insertions(+) > > diff --git a/doc/protocols.texi b/doc/protocols.texi > index 726e5f1..9c246f8 100644 > --- a/doc/protocols.texi > +++ b/doc/protocols.texi > @@ -1496,6 +1496,16 @@ when the old encryption key is decommissioned. Default > is -1. > -1 means auto (0x1000 in srt library). The range for > this option is integers in the 0 - @code{INT_MAX}. > > +@item snddropdelay=@var{microseconds} > +The sender's delay before dropping packets. This delay is > +added to the default drop delay time interval value. > +Keep in mind that the longer the delay, the more probable it > +becomes that packets would be retransmitted uselessly because > +they will be dropped by the receiver anyway. > + > +Default is -1 means auto which typically means do not drop > +packets on the sender at all. > + > @item payload_size=@var{bytes} > Sets the maximum declared size of a packet transferred > during the single call to the sending function in Live > diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c > index c6308d1..13697d2 100644 > --- a/libavformat/libsrt.c > +++ b/libavformat/libsrt.c > @@ -65,6 +65,7 @@ typedef struct SRTContext { > int enforced_encryption; > int kmrefreshrate; > int kmpreannounce; > +int64_t snddropdelay; > #endif > int mss; > int ffs; > @@ -111,6 +112,7 @@ static const AVOption libsrt_options[] = { > { "enforced_encryption", "Enforces that both connection parties have the > same passphrase set", > OFFSET(enforced_encryption), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, > .flags = D|E }, > { "kmrefreshrate", "The number of packets to be transmitted after > which the encryption key is switched to a new key", OFFSET(kmrefreshrate), >AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, > { "kmpreannounce", "The interval between when a new encryption key > is sent and when switchover occurs", OFFSET(kmpreannounce), > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, > +{ "snddropdelay","The sender's delay(in microseconds) before > dropping packets", OFFSET(snddropdelay), > AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E }, > #endif > { "mss","The Maximum Segment Size", >OFFSET(mss), AV_OPT_TYPE_INT, { .i64 = > -1 }, -1, 1500, .flags = D|E }, > { "ffs","Flight flag size (window size) (in bytes)", >OFFSET(ffs), AV_OPT_TYPE_INT, { .i64 = > -1 }, -1, INT_MAX, .flags = D|E }, > @@ -318,6 +320,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) > int latency = s->latency / 1000; > int rcvlatency = s->rcvlatency / 1000; > int peerlatency = s->peerlatency / 1000; > +int snddropdelay = s->snddropdelay / 1000; > int connect_timeout = s->connect_timeout; > > if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd, > SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) || > @@ -334,6 +337,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) > #endif > (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, > SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, > sizeof(s->kmrefreshrate)) < 0) || > (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, > SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, > sizeof(s->kmpreannounce)) < 0) || > +(s->snddropdelay >= 0 && libsrt_setsockopt(h, fd, > SRTO_SNDDROPDELAY, "SRTO_SNDDROPDELAY", &snddropdelay, > sizeof(snddropdelay)) < 0) || > #endif > (s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MSS", > &s->mss, sizeof(s->mss)) < 0) || > (s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC", > &s->ffs, sizeof(s->ffs)) < 0) || > @@ -549,6 +553,9 @@ static int libsrt_open(URLContext *h, const char *uri, > int flags) > if (av_find_info_tag(buf, sizeof(buf), "kmpreannounce", p)) { > s->kmpreannounce = strtol(buf, NULL, 10); > } > +if (av_find_info_tag(buf, sizeof(buf), "snddropdelay", p)) { > +s->snddropdelay = strtoll(buf, NULL, 10); > +} > #endif > if (av_find_info_tag(buf, sizeof(buf), "mss", p)) { > s->mss = strtol(buf, NULL, 10); will apply patch set(3,4,5) in two day unless there are objections. > -- > 1.8.3.1 > -- 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-deve
Re: [FFmpeg-devel] [PATCH 5/5] avformat/libsrt: add snddropdelay parameter for srt
On Sun, Oct 10, 2021 at 01:22:49AM +0800, "zhilizhao(赵志立)" wrote: > > > > On Sep 30, 2021, at 9:14 AM, lance.lmw...@gmail.com wrote: > > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > doc/protocols.texi | 10 ++ > > libavformat/libsrt.c | 7 +++ > > 2 files changed, 17 insertions(+) > > > > diff --git a/doc/protocols.texi b/doc/protocols.texi > > index 726e5f1..9c246f8 100644 > > --- a/doc/protocols.texi > > +++ b/doc/protocols.texi > > @@ -1496,6 +1496,16 @@ when the old encryption key is decommissioned. > > Default is -1. > > -1 means auto (0x1000 in srt library). The range for > > this option is integers in the 0 - @code{INT_MAX}. > > > > +@item snddropdelay=@var{microseconds} > > +The sender's delay before dropping packets. This delay is > > +added to the default drop delay time interval value. > > +Keep in mind that the longer the delay, the more probable it > > +becomes that packets would be retransmitted uselessly because > > +they will be dropped by the receiver anyway. > > + > > +Default is -1 means auto which typically means do not drop > > +packets on the sender at all. > > There are two issues here: > > Firstly, -1 means auto for our libsrt wrapper. "typically means do not drop > packets on the sender at all” is incorrect. The default value of libsrt is > 0 for live mode, -1 for file mode. Live mode is the default and the file mode > doesn’t matter much for FFmpeg, TBH. > > Secondly, since our wrapper and libsrt defined different sematic for -1, now > it’s impossible to pass -1 to libsrt. Yes, the default is misleading. I'll add -2 for auto for wrapper, it'll be unset mode and will be use the default value of libsrt. Then -1 can pass to libsrt.c also. > > And the description from libsrt doc > > > Keep in mind that the longer the delay, the more probable it becomes that > > packets would be > > retransmitted > > can mislead the user to set a higher value for it, which is not a good idea. > I don’t know how to improve that. > > > + > > @item payload_size=@var{bytes} > > Sets the maximum declared size of a packet transferred > > during the single call to the sending function in Live > > diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c > > index c6308d1..13697d2 100644 > > --- a/libavformat/libsrt.c > > +++ b/libavformat/libsrt.c > > @@ -65,6 +65,7 @@ typedef struct SRTContext { > > int enforced_encryption; > > int kmrefreshrate; > > int kmpreannounce; > > +int64_t snddropdelay; > > #endif > > int mss; > > int ffs; > > @@ -111,6 +112,7 @@ static const AVOption libsrt_options[] = { > > { "enforced_encryption", "Enforces that both connection parties have > > the same passphrase set", > > OFFSET(enforced_encryption), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, > > .flags = D|E }, > > { "kmrefreshrate", "The number of packets to be transmitted after > > which the encryption key is switched to a new key", OFFSET(kmrefreshrate), > > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, > > { "kmpreannounce", "The interval between when a new encryption > > key is sent and when switchover occurs", > > OFFSET(kmpreannounce), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, > > .flags = D|E }, > > +{ "snddropdelay","The sender's delay(in microseconds) before > > dropping packets", > > OFFSET(snddropdelay),AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, > > INT64_MAX, .flags = D|E }, > > #endif > > { "mss","The Maximum Segment Size", > > OFFSET(mss), AV_OPT_TYPE_INT, { .i64 > > = -1 }, -1, 1500, .flags = D|E }, > > { "ffs","Flight flag size (window size) (in bytes)", > > OFFSET(ffs), AV_OPT_TYPE_INT, { .i64 > > = -1 }, -1, INT_MAX, .flags = D|E }, > > @@ -318,6 +320,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) > > int latency = s->latency / 1000; > > int rcvlatency = s->rcvlatency / 1000; > > int peerlatency = s->peerlatency / 1000; > > +int snddropdelay = s->snddropdelay / 1000; > > int connect_timeout = s->connect_timeout; > > > > if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd, > > SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) || > > @@ -334,6 +337,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) > > #endif > > (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, > > SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, > > sizeof(s->kmrefreshrate)) < 0) || > > (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, > > SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, > > sizeof(s->kmpreannounce)) < 0) || > > +(s->snddropdelay >= 0 && libsrt_setsockopt(h, fd, > > SRTO_SNDDROPDELAY, "SRTO_SNDDROP
[FFmpeg-devel] [PATCH v2] avformat/libsrt: add snddropdelay parameter for srt
From: Limin Wang Signed-off-by: Limin Wang --- doc/protocols.texi | 9 + libavformat/libsrt.c | 7 +++ 2 files changed, 16 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index 726e5f1..7951abb 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1496,6 +1496,15 @@ when the old encryption key is decommissioned. Default is -1. -1 means auto (0x1000 in srt library). The range for this option is integers in the 0 - @code{INT_MAX}. +@item snddropdelay=@var{microseconds} +The sender's delay before dropping packets. This delay is +added to the default drop delay time interval value. + +Default is -2 which typically means it's unset and use the +the default by libsrt(Default: 0 in Live mode, -1 in File mode). + +Special value -1: Do not drop packets on the sender at all. + @item payload_size=@var{bytes} Sets the maximum declared size of a packet transferred during the single call to the sending function in Live diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index c6308d1..c2e633b 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -65,6 +65,7 @@ typedef struct SRTContext { int enforced_encryption; int kmrefreshrate; int kmpreannounce; +int64_t snddropdelay; #endif int mss; int ffs; @@ -111,6 +112,7 @@ static const AVOption libsrt_options[] = { { "enforced_encryption", "Enforces that both connection parties have the same passphrase set", OFFSET(enforced_encryption), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, .flags = D|E }, { "kmrefreshrate", "The number of packets to be transmitted after which the encryption key is switched to a new key", OFFSET(kmrefreshrate), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { "kmpreannounce", "The interval between when a new encryption key is sent and when switchover occurs", OFFSET(kmpreannounce), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, +{ "snddropdelay","The sender's delay(in microseconds) before dropping packets", OFFSET(snddropdelay), AV_OPT_TYPE_INT64, { .i64 = -2 }, -2, INT64_MAX, .flags = D|E }, #endif { "mss","The Maximum Segment Size", OFFSET(mss), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1500, .flags = D|E }, { "ffs","Flight flag size (window size) (in bytes)", OFFSET(ffs), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, @@ -318,6 +320,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) int latency = s->latency / 1000; int rcvlatency = s->rcvlatency / 1000; int peerlatency = s->peerlatency / 1000; +int snddropdelay = s->snddropdelay > 0 ? s->snddropdelay / 1000 : s->snddropdelay; int connect_timeout = s->connect_timeout; if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd, SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) || @@ -334,6 +337,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) #endif (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) || (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) || +(s->snddropdelay >=-1 && libsrt_setsockopt(h, fd, SRTO_SNDDROPDELAY, "SRTO_SNDDROPDELAY", &snddropdelay, sizeof(snddropdelay)) < 0) || #endif (s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MSS", &s->mss, sizeof(s->mss)) < 0) || (s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC", &s->ffs, sizeof(s->ffs)) < 0) || @@ -549,6 +553,9 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) if (av_find_info_tag(buf, sizeof(buf), "kmpreannounce", p)) { s->kmpreannounce = strtol(buf, NULL, 10); } +if (av_find_info_tag(buf, sizeof(buf), "snddropdelay", p)) { +s->snddropdelay = strtoll(buf, NULL, 10); +} #endif if (av_find_info_tag(buf, sizeof(buf), "mss", p)) { s->mss = strtol(buf, NULL, 10); -- 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 v2] avformat/libsrt: add snddropdelay parameter for srt
On Sun, Oct 10, 2021 at 09:46:26PM +0800, "zhilizhao(赵志立)" wrote: > > > > On Oct 10, 2021, at 11:17 AM, lance.lmw...@gmail.com wrote: > > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > doc/protocols.texi | 9 + > > libavformat/libsrt.c | 7 +++ > > 2 files changed, 16 insertions(+) > > > > diff --git a/doc/protocols.texi b/doc/protocols.texi > > index 726e5f1..7951abb 100644 > > --- a/doc/protocols.texi > > +++ b/doc/protocols.texi > > @@ -1496,6 +1496,15 @@ when the old encryption key is decommissioned. > > Default is -1. > > -1 means auto (0x1000 in srt library). The range for > > this option is integers in the 0 - @code{INT_MAX}. > > > > +@item snddropdelay=@var{microseconds} > > +The sender's delay before dropping packets. This delay is > > snddropdelay is NOT the delay before dropping packets, it’s > an extra delay. If you prefer to add extra before delay, I'm OK with that. In fact, it's coming the short description of apps/srt-live-transmit.md for snddropdelay. More description are coming from API/API-socket-options.md: Sets an extra delay before TLPKTDROP is triggered on the data sender. This delay is added to the default drop delay time interval value. Keep in mind that the longer the delay, the more probable it becomes that packets would be retransmitted uselessly because they will be dropped by the receiver anyway. For you think it's not good for the "Keep in mind...", so I remove it anyway. > > > +added to the default drop delay time interval value. > > + > > +Default is -2 which typically means it's unset and use the > ^ > > +the default by libsrt(Default: 0 in Live mode, -1 in File mode). > ^^ > > + > > which means using the default. > > On the other hand, -2 is an implementation detail and not a real > value for snddropdelay, so it doesn’t need to be mentioned in the > doc. OK, will remove about -2. > > > +Special value -1: Do not drop packets on the sender at all. > > + > > @item payload_size=@var{bytes} > > Sets the maximum declared size of a packet transferred > > during the single call to the sending function in Live > > diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c > > index c6308d1..c2e633b 100644 > > --- a/libavformat/libsrt.c > > +++ b/libavformat/libsrt.c > > @@ -65,6 +65,7 @@ typedef struct SRTContext { > > int enforced_encryption; > > int kmrefreshrate; > > int kmpreannounce; > > +int64_t snddropdelay; > > #endif > > int mss; > > int ffs; > > @@ -111,6 +112,7 @@ static const AVOption libsrt_options[] = { > > { "enforced_encryption", "Enforces that both connection parties have > > the same passphrase set", > > OFFSET(enforced_encryption), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, > > .flags = D|E }, > > { "kmrefreshrate", "The number of packets to be transmitted after > > which the encryption key is switched to a new key", OFFSET(kmrefreshrate), > > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, > > { "kmpreannounce", "The interval between when a new encryption > > key is sent and when switchover occurs", > > OFFSET(kmpreannounce), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, > > .flags = D|E }, > > +{ "snddropdelay","The sender's delay(in microseconds) before > > dropping packets", > > OFFSET(snddropdelay),AV_OPT_TYPE_INT64, { .i64 = -2 }, -2, > > INT64_MAX, .flags = D|E }, > > #endif > > { "mss","The Maximum Segment Size", > > OFFSET(mss), AV_OPT_TYPE_INT, { .i64 > > = -1 }, -1, 1500, .flags = D|E }, > > { "ffs","Flight flag size (window size) (in bytes)", > > OFFSET(ffs), AV_OPT_TYPE_INT, { .i64 > > = -1 }, -1, INT_MAX, .flags = D|E }, > > @@ -318,6 +320,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) > > int latency = s->latency / 1000; > > int rcvlatency = s->rcvlatency / 1000; > > int peerlatency = s->peerlatency / 1000; > > +int snddropdelay = s->snddropdelay > 0 ? s->snddropdelay / 1000 : > > s->snddropdelay; > > int connect_timeout = s->connect_timeout; > > > > if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd, > > SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) || > > @@ -334,6 +337,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) > > #endif > > (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, > > SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, > > sizeof(s->kmrefreshrate)) < 0) || > > (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, > > SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, > > sizeof(s->kmpreannounce)) < 0) || > > +(s->snddropdelay >=-
[FFmpeg-devel] [PATCH v3] avformat/libsrt: add snddropdelay parameter for srt
From: Limin Wang Signed-off-by: Limin Wang --- doc/protocols.texi | 6 ++ libavformat/libsrt.c | 7 +++ 2 files changed, 13 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index 726e5f1..c100f23 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1496,6 +1496,12 @@ when the old encryption key is decommissioned. Default is -1. -1 means auto (0x1000 in srt library). The range for this option is integers in the 0 - @code{INT_MAX}. +@item snddropdelay=@var{microseconds} +The sender's extra delay before dropping packets. This delay is +added to the default drop delay time interval value. + +Special value -1: Do not drop packets on the sender at all. + @item payload_size=@var{bytes} Sets the maximum declared size of a packet transferred during the single call to the sending function in Live diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index c6308d1..145eea2 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -65,6 +65,7 @@ typedef struct SRTContext { int enforced_encryption; int kmrefreshrate; int kmpreannounce; +int64_t snddropdelay; #endif int mss; int ffs; @@ -111,6 +112,7 @@ static const AVOption libsrt_options[] = { { "enforced_encryption", "Enforces that both connection parties have the same passphrase set", OFFSET(enforced_encryption), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, .flags = D|E }, { "kmrefreshrate", "The number of packets to be transmitted after which the encryption key is switched to a new key", OFFSET(kmrefreshrate), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { "kmpreannounce", "The interval between when a new encryption key is sent and when switchover occurs", OFFSET(kmpreannounce), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, +{ "snddropdelay","The sender's extra delay(in microseconds) before dropping packets", OFFSET(snddropdelay), AV_OPT_TYPE_INT64, { .i64 = -2 }, -2, INT64_MAX, .flags = D|E }, #endif { "mss","The Maximum Segment Size", OFFSET(mss), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1500, .flags = D|E }, { "ffs","Flight flag size (window size) (in bytes)", OFFSET(ffs), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, @@ -318,6 +320,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) int latency = s->latency / 1000; int rcvlatency = s->rcvlatency / 1000; int peerlatency = s->peerlatency / 1000; +int snddropdelay = s->snddropdelay > 0 ? s->snddropdelay / 1000 : s->snddropdelay; int connect_timeout = s->connect_timeout; if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd, SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) || @@ -334,6 +337,7 @@ static int libsrt_set_options_pre(URLContext *h, int fd) #endif (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) || (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) || +(s->snddropdelay >=-1 && libsrt_setsockopt(h, fd, SRTO_SNDDROPDELAY, "SRTO_SNDDROPDELAY", &snddropdelay, sizeof(snddropdelay)) < 0) || #endif (s->mss >= 0 && libsrt_setsockopt(h, fd, SRTO_MSS, "SRTO_MSS", &s->mss, sizeof(s->mss)) < 0) || (s->ffs >= 0 && libsrt_setsockopt(h, fd, SRTO_FC, "SRTO_FC", &s->ffs, sizeof(s->ffs)) < 0) || @@ -549,6 +553,9 @@ static int libsrt_open(URLContext *h, const char *uri, int flags) if (av_find_info_tag(buf, sizeof(buf), "kmpreannounce", p)) { s->kmpreannounce = strtol(buf, NULL, 10); } +if (av_find_info_tag(buf, sizeof(buf), "snddropdelay", p)) { +s->snddropdelay = strtoll(buf, NULL, 10); +} #endif if (av_find_info_tag(buf, sizeof(buf), "mss", p)) { s->mss = strtol(buf, NULL, 10); -- 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 1/8] avformat: add raw avs3 muxer
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/rawenc.c | 14 ++ 3 files changed, 16 insertions(+) diff --git a/libavformat/Makefile b/libavformat/Makefile index c45caa3..66ebea5 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -130,6 +130,7 @@ OBJS-$(CONFIG_AVS_DEMUXER) += avs.o voc_packet.o voc.o OBJS-$(CONFIG_AVS2_DEMUXER) += avs2dec.o rawdec.o OBJS-$(CONFIG_AVS2_MUXER)+= rawenc.o OBJS-$(CONFIG_AVS3_DEMUXER) += avs3dec.o rawdec.o +OBJS-$(CONFIG_AVS3_MUXER)+= rawenc.o OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o OBJS-$(CONFIG_BINK_DEMUXER) += bink.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 889cfcc..cbfadcb 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -88,6 +88,7 @@ extern const AVInputFormat ff_avs_demuxer; extern const AVInputFormat ff_avs2_demuxer; extern const AVOutputFormat ff_avs2_muxer; extern const AVInputFormat ff_avs3_demuxer; +extern const AVOutputFormat ff_avs3_muxer; extern const AVInputFormat ff_bethsoftvid_demuxer; extern const AVInputFormat ff_bfi_demuxer; extern const AVInputFormat ff_bintext_demuxer; diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index ad29e71..15e7051 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -142,6 +142,20 @@ const AVOutputFormat ff_avs2_muxer = { }; #endif +#if CONFIG_AVS3_MUXER +const AVOutputFormat ff_avs3_muxer = { +.name = "avs3", +.long_name = NULL_IF_CONFIG_SMALL("AVS3-P2/IEEE1857.10"), +.extensions= "avs3", +.audio_codec = AV_CODEC_ID_NONE, +.video_codec = AV_CODEC_ID_AVS3, +.init = force_one_stream, +.write_packet = ff_raw_write_packet, +.flags = AVFMT_NOTIMESTAMPS, +}; +#endif + + #if CONFIG_CAVSVIDEO_MUXER const AVOutputFormat ff_cavsvideo_muxer = { .name = "cavsvideo", -- 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/8] avcodec/extract_extradata_bsf: add support for AVS3
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/extract_extradata_bsf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c index 32c732f..dbcb850 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c @@ -328,6 +328,7 @@ static const struct { } extract_tab[] = { { AV_CODEC_ID_AV1,extract_extradata_av1 }, { AV_CODEC_ID_AVS2, extract_extradata_mpeg4 }, +{ AV_CODEC_ID_AVS3, extract_extradata_mpeg4 }, { AV_CODEC_ID_CAVS, extract_extradata_mpeg4 }, { AV_CODEC_ID_H264, extract_extradata_h2645 }, { AV_CODEC_ID_HEVC, extract_extradata_h2645 }, @@ -396,6 +397,7 @@ static void extract_extradata_close(AVBSFContext *ctx) static const enum AVCodecID codec_ids[] = { AV_CODEC_ID_AV1, AV_CODEC_ID_AVS2, +AV_CODEC_ID_AVS3, AV_CODEC_ID_CAVS, AV_CODEC_ID_H264, AV_CODEC_ID_HEVC, -- 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/8] avformat/mpegts: add support for stream_type 0xd2, which is AVS2
From: Limin Wang GB/T 17975.1 Information technology-Generic coding of moving pictures and associated audio information-Part 1:Systems Signed-off-by: Limin Wang --- libavformat/mpegts.h| 1 + libavformat/mpegtsenc.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h index c75ba08..910d65a 100644 --- a/libavformat/mpegts.h +++ b/libavformat/mpegts.h @@ -129,6 +129,7 @@ #define STREAM_TYPE_VIDEO_H264 0x1b #define STREAM_TYPE_VIDEO_HEVC 0x24 #define STREAM_TYPE_VIDEO_CAVS 0x42 +#define STREAM_TYPE_VIDEO_AVS2 0xd2 #define STREAM_TYPE_VIDEO_VC1 0xea #define STREAM_TYPE_VIDEO_DIRAC 0xd1 diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 98dac17..f3b7914 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -366,6 +366,9 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream *st) case AV_CODEC_ID_CAVS: stream_type = STREAM_TYPE_VIDEO_CAVS; break; +case AV_CODEC_ID_AVS2: +stream_type = STREAM_TYPE_VIDEO_AVS2; +break; case AV_CODEC_ID_DIRAC: stream_type = STREAM_TYPE_VIDEO_DIRAC; break; -- 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/8] avformat/mpegts: add support for stream_type 0xd4, which is AVS3
From: Limin Wang GB/T 17975.1 Information technology-Generic coding of moving pictures and associated audio information-Part 1:Systems Signed-off-by: Limin Wang --- libavformat/mpegts.c| 1 + libavformat/mpegts.h| 1 + libavformat/mpegtsenc.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 9a6bbb1..d3a4e4e 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -807,6 +807,7 @@ static const StreamType ISO_types[] = { { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS }, { 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC }, { 0xd2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2 }, +{ 0xd4, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS3 }, { 0xea, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1}, { 0 }, }; diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h index 910d65a..a48f14e 100644 --- a/libavformat/mpegts.h +++ b/libavformat/mpegts.h @@ -130,6 +130,7 @@ #define STREAM_TYPE_VIDEO_HEVC 0x24 #define STREAM_TYPE_VIDEO_CAVS 0x42 #define STREAM_TYPE_VIDEO_AVS2 0xd2 +#define STREAM_TYPE_VIDEO_AVS3 0xd4 #define STREAM_TYPE_VIDEO_VC1 0xea #define STREAM_TYPE_VIDEO_DIRAC 0xd1 diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index f3b7914..26fb1f1 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -369,6 +369,9 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream *st) case AV_CODEC_ID_AVS2: stream_type = STREAM_TYPE_VIDEO_AVS2; break; +case AV_CODEC_ID_AVS3: +stream_type = STREAM_TYPE_VIDEO_AVS3; +break; case AV_CODEC_ID_DIRAC: stream_type = STREAM_TYPE_VIDEO_DIRAC; break; -- 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/8] avformat/mpegtsenc: add AVSV format_identifier for AVS standard
From: Limin Wang Listing of Registered Identifiers: https://smpte-ra.org/registered-mpeg-ts-ids Signed-off-by: Limin Wang --- libavformat/mpegtsenc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 26fb1f1..184bb52 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -789,6 +789,9 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) put_registration_descriptor(&q, MKTAG('V', 'C', '-', '1')); } else if (stream_type == STREAM_TYPE_VIDEO_HEVC && s->strict_std_compliance <= FF_COMPLIANCE_NORMAL) { put_registration_descriptor(&q, MKTAG('H', 'E', 'V', 'C')); +} else if (stream_type == STREAM_TYPE_VIDEO_CAVS || stream_type == STREAM_TYPE_VIDEO_AVS2 || + stream_type == STREAM_TYPE_VIDEO_AVS3) { +put_registration_descriptor(&q, MKTAG('A', 'V', 'S', 'V')); } break; case AVMEDIA_TYPE_DATA: -- 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 6/8] avcodec/hevcdec: remove unused code
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevcdec.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 482638a..2855342 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -45,9 +45,6 @@ #define SHIFT_CTB_WPP 2 -//TODO: check if this is really the maximum -#define MAX_TRANSFORM_DEPTH 5 - #define MAX_TB_SIZE 32 #define MAX_QP 51 #define DEFAULT_INTRA_TC_OFFSET 2 -- 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 7/8] avcodec/hevc_filter: remove unneeded headers
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevc_filter.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 6b98240..7e9478c 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -25,11 +25,8 @@ #include "libavutil/common.h" #include "libavutil/internal.h" -#include "cabac_functions.h" #include "hevcdec.h" -#include "bit_depth_template.c" - #define LUMA 0 #define CB 1 #define CR 2 -- 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 8/8] avcodec/hevc_filter: Correct indention
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevc_filter.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 7e9478c..3c45b5a 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -138,7 +138,7 @@ static int get_qPy(HEVCContext *s, int xC, int yC) static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height, ptrdiff_t stride_dst, ptrdiff_t stride_src) { -int i, j; +int i, j; if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) { for (i = 0; i < height; i++) { @@ -319,18 +319,18 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) x_ctb, y_ctb); if (s->ps.pps->transquant_bypass_enable_flag || (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) { -dst = lc->edge_emu_buffer; -stride_dst = 2*MAX_PB_SIZE; -copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src); -s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst, -sao->offset_val[c_idx], sao->band_position[c_idx], -width, height); -restore_tqb_pixels(s, src, dst, stride_src, stride_dst, - x, y, width, height, c_idx); +dst = lc->edge_emu_buffer; +stride_dst = 2*MAX_PB_SIZE; +copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src); +s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst, +sao->offset_val[c_idx], sao->band_position[c_idx], +width, height); +restore_tqb_pixels(s, src, dst, stride_src, stride_dst, + x, y, width, height, c_idx); } else { -s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src, -sao->offset_val[c_idx], sao->band_position[c_idx], -width, height); +s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src, +sao->offset_val[c_idx], sao->band_position[c_idx], +width, height); } sao->type_idx[c_idx] = SAO_APPLIED; break; -- 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 8/8] avformat/rtpdec_rfc4175: add support for RANGE
On Wed, Oct 06, 2021 at 06:14:11PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavformat/rtpdec_rfc4175.c | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > index 23a3f4f..86ffb38 100644 > --- a/libavformat/rtpdec_rfc4175.c > +++ b/libavformat/rtpdec_rfc4175.c > @@ -32,6 +32,7 @@ struct PayloadContext { > char *framerate; > char *TCS; > char *colorimetry; > +char *range; > int depth; > int width; > int height; > @@ -97,6 +98,13 @@ static int rfc4175_parse_format(AVStream *stream, > PayloadContext *data) > stream->codecpar->color_space = AVCOL_SPC_BT2020_NCL; > } > > +if (!data->range) > +stream->codecpar->color_range = AVCOL_RANGE_MPEG; > +else if (!strncmp(data->range, "NARROW", 6)) > +stream->codecpar->color_range = AVCOL_RANGE_MPEG; > +else if (!strncmp(data->range, "FULL", 4)) > +stream->codecpar->color_range = AVCOL_RANGE_JPEG; > + > desc = av_pix_fmt_desc_get(pixfmt); > stream->codecpar->format = pixfmt; > stream->codecpar->codec_tag = tag; > @@ -132,6 +140,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, > AVStream *stream, > data->TCS = av_strdup(value); > else if (!strncmp(attr, "colorimetry", 11)) > data->colorimetry = av_strdup(value); > +else if (!strncmp(attr, "RANGE", 5)) > +data->range = av_strdup(value); > > return 0; > } > @@ -163,6 +173,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int > st_index, > av_freep(&data->framerate); > av_freep(&data->TCS); > av_freep(&data->colorimetry); > +av_freep(&data->range); > > return ret; > } > -- > 1.8.3.1 > will apply the patch set tomorrow unless there are objections. -- 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 5/8] avformat/rtpdec_rfc4175: add support for exactframerate
On Mon, Oct 11, 2021 at 05:00:29PM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavformat/rtpdec_rfc4175.c | 14 ++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > > index 46d30ed..367567d 100644 > > --- a/libavformat/rtpdec_rfc4175.c > > +++ b/libavformat/rtpdec_rfc4175.c > > @@ -25,9 +25,11 @@ > > #include "rtpdec_formats.h" > > #include "libavutil/avstring.h" > > #include "libavutil/pixdesc.h" > > +#include "libavutil/parseutils.h" > > > > struct PayloadContext { > > char *sampling; > > +char *framerate; > > int depth; > > int width; > > int height; > > @@ -45,6 +47,7 @@ static int rfc4175_parse_format(AVStream *stream, > > PayloadContext *data) > > enum AVPixelFormat pixfmt; > > int tag; > > const AVPixFmtDescriptor *desc; > > +AVRational framerate; > > > > if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { > > tag = MKTAG('U', 'Y', 'V', 'Y'); > > @@ -69,6 +72,14 @@ static int rfc4175_parse_format(AVStream *stream, > > PayloadContext *data) > > stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); > > data->frame_size = data->width * data->height * data->pgroup / > > data->xinc; > > > > +if (data->framerate) { > > +if (av_parse_video_rate(&framerate, data->framerate) < 0) > > +return AVERROR(EINVAL); > > +stream->avg_frame_rate = framerate; > > +if (framerate.den) > > +stream->codecpar->bit_rate = data->frame_size * > > av_q2d(framerate) * 8; > > +} > > + > > return 0; > > } > > > > @@ -84,6 +95,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, > > AVStream *stream, > > data->sampling = av_strdup(value); > > else if (!strncmp(attr, "depth", 5)) > > data->depth = atoi(value); > > +else if (!strncmp(attr, "exactframerate", 14)) > > +data->framerate = av_strdup(value); > > > > return 0; > > } > > @@ -112,6 +125,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, > > int st_index, > > > > ret = rfc4175_parse_format(stream, data); > > av_freep(&data->sampling); > > +av_freep(&data->framerate); > > > > return ret; > > } > > > > Why the (unchecked!) allocation of a temporary string if you only want > the number anyway? I'm just following the same style for sampling, but I can change to parse the frame rate when parsing fmtp string to save the temporary string allocation if you prefer to. > > - 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". -- 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 6/8] avformat/rtpdec_rfc4175: add support for TCS
On Mon, Oct 11, 2021 at 05:01:54PM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavformat/rtpdec_rfc4175.c | 19 +++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > > index 367567d..db6b9b8 100644 > > --- a/libavformat/rtpdec_rfc4175.c > > +++ b/libavformat/rtpdec_rfc4175.c > > @@ -30,6 +30,7 @@ > > struct PayloadContext { > > char *sampling; > > char *framerate; > > +char *TCS; > > int depth; > > int width; > > int height; > > @@ -66,6 +67,21 @@ static int rfc4175_parse_format(AVStream *stream, > > PayloadContext *data) > > return AVERROR_INVALIDDATA; > > } > > > > +if (!data->TCS) > > +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; > > +else if (!strncmp(data->TCS, "SDR", 3)) > > +stream->codecpar->color_trc = AVCOL_TRC_BT709; > > +else if (!strncmp(data->TCS, "PQ", 2)) > > +stream->codecpar->color_trc = AVCOL_TRC_SMPTE2084; > > +else if (!strncmp(data->TCS, "HLG", 3)) > > +stream->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67; > > +else if (!strncmp(data->TCS, "LINEAR", 6)) > > +stream->codecpar->color_trc = AVCOL_TRC_LINEAR; > > +else if (!strncmp(data->TCS, "ST428-1", 7)) > > +stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; > > +else if (!strncmp(data->TCS, "UNSPECIFIED", 11)) > > +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; > > + > > desc = av_pix_fmt_desc_get(pixfmt); > > stream->codecpar->format = pixfmt; > > stream->codecpar->codec_tag = tag; > > @@ -97,6 +113,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, > > AVStream *stream, > > data->depth = atoi(value); > > else if (!strncmp(attr, "exactframerate", 14)) > > data->framerate = av_strdup(value); > > +else if (!strncmp(attr, "TCS", 3)) > > +data->TCS = av_strdup(value); > > > > return 0; > > } > > @@ -126,6 +144,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, > > int st_index, > > ret = rfc4175_parse_format(stream, data); > > av_freep(&data->sampling); > > av_freep(&data->framerate); > > +av_freep(&data->TCS); > > > > return ret; > > } > > > > Same here: Why an (unchecked) temporary value? OK, will updated to remove the temporary value. > > - 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". -- 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] [PATCH v2 1/4] avformat/rtpdec_rfc4175: add support for exactframerate
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 712c683..060f725 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -25,9 +25,11 @@ #include "rtpdec_formats.h" #include "libavutil/avstring.h" #include "libavutil/pixdesc.h" +#include "libavutil/parseutils.h" struct PayloadContext { char *sampling; +AVRational framerate; int depth; int width; int height; @@ -69,6 +71,11 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); data->frame_size = data->width * data->height * data->pgroup / data->xinc; +if (data->framerate.den > 0) { +stream->avg_frame_rate = data->framerate; +stream->codecpar->bit_rate = data->frame_size * av_q2d(data->framerate) * 8; +} + return 0; } @@ -84,6 +91,10 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->sampling = av_strdup(value); else if (!strncmp(attr, "depth", 5)) data->depth = atoi(value); +else if (!strncmp(attr, "exactframerate", 14)) { +if (av_parse_video_rate(&data->framerate, value) < 0) +return AVERROR(EINVAL); +} return 0; } -- 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 v2 2/4] avformat/rtpdec_rfc4175: add support for TCS
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 13 + 1 file changed, 13 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 060f725..d45530e 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -94,6 +94,19 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, else if (!strncmp(attr, "exactframerate", 14)) { if (av_parse_video_rate(&data->framerate, value) < 0) return AVERROR(EINVAL); +} else if (!strncmp(attr, "TCS", 3)) { +if (!strncmp(value, "SDR", 3)) +stream->codecpar->color_trc = AVCOL_TRC_BT709; +else if (!strncmp(value, "PQ", 2)) +stream->codecpar->color_trc = AVCOL_TRC_SMPTE2084; +else if (!strncmp(value, "HLG", 3)) +stream->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67; +else if (!strncmp(value, "LINEAR", 6)) +stream->codecpar->color_trc = AVCOL_TRC_LINEAR; +else if (!strncmp(value, "ST428-1", 7)) +stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; +else +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; } return 0; -- 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 v2 3/4] avformat/rtpdec_rfc4175: add support for colorimetry
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index d45530e..93607d7 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -107,6 +107,17 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; else stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; +} else if (!strncmp(attr, "colorimetry", 11)) { +if (!strncmp(value, "BT601", 5)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT470BG; +stream->codecpar->color_space = AVCOL_SPC_BT470BG; +} else if (!strncmp(value, "BT709", 5)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT709; +stream->codecpar->color_space = AVCOL_SPC_BT709; +} else if (!strncmp(value, "BT2020", 6)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT2020; +stream->codecpar->color_space = AVCOL_SPC_BT2020_NCL; +} } return 0; -- 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 v2 4/4] avformat/rtpdec_rfc4175: add support for RANGE
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 93607d7..f50cad7 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -118,6 +118,11 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, stream->codecpar->color_primaries = AVCOL_PRI_BT2020; stream->codecpar->color_space = AVCOL_SPC_BT2020_NCL; } +} else if (!strncmp(attr, "RANGE", 5)) { +if (!strncmp(value, "NARROW", 6)) +stream->codecpar->color_range = AVCOL_RANGE_MPEG; +else if (!strncmp(value, "FULL", 4)) +stream->codecpar->color_range = AVCOL_RANGE_JPEG; } return 0; -- 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 1/8] avfilter/af_replaygain: use fabsf() instead of fabs()
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/af_replaygain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c index 4bf2763..da5c196 100644 --- a/libavfilter/af_replaygain.c +++ b/libavfilter/af_replaygain.c @@ -428,7 +428,7 @@ static void butter_filter_stereo_samples(ReplayGainContext *s, // (slowing us down). for (j = -4; j < 0; ++j) -if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10) +if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10) break; if (!j) { @@ -477,7 +477,7 @@ static void yule_filter_stereo_samples(ReplayGainContext *s, const float *src, // (slowing us down). for (j = -20; j < 0; ++j) -if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10) +if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10) break; if (!j) { -- 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/8] avfilter/vf_showinfo: small adjustments for the HDR10+ dump
From: Limin Wang summary for the adjustments: 1, remove the extra "," in the ,} ...{0.2004,0.3001,0.4008,0.5005,0.6002,0.7009,0.8006,0.9013,} to ...{0.2004,0.3001,0.4008,0.5005,0.6002,0.7009,0.8006,0.9013} 2, add "," between the } and new field } fraction_bright_pixels to }, fraction_bright_pixels 3, remove the extra space between "} }" ...{0.2004,0.3001,0.4008,0.5005,0.6002,0.7009,0.8006,0.9013,} } to ...{0.2004,0.3001,0.4008,0.5005,0.6002,0.7009,0.8006,0.9013,}} Signed-off-by: Limin Wang --- libavfilter/vf_showinfo.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index c8c7b98..ff438e7 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -221,7 +221,7 @@ static void dump_dynamic_hdr_plus(AVFilterContext *ctx, AVFrameSideData *sd) av_log(ctx, AV_LOG_INFO, "num_windows: %d, ", hdr_plus->num_windows); for (int w = 1; w < hdr_plus->num_windows; w++) { AVHDRPlusColorTransformParams *params = &hdr_plus->params[w]; -av_log(ctx, AV_LOG_INFO, "window %d { ", w); +av_log(ctx, AV_LOG_INFO, w > 1 ? ", window %d { " : "window %d { ", w); av_log(ctx, AV_LOG_INFO, "window_upper_left_corner: (%5.4f,%5.4f),", av_q2d(params->window_upper_left_corner_x), av_q2d(params->window_upper_left_corner_y)); @@ -242,7 +242,7 @@ static void dump_dynamic_hdr_plus(AVFilterContext *ctx, AVFrameSideData *sd) params->semimajor_axis_external_ellipse); av_log(ctx, AV_LOG_INFO, "semiminor_axis_external_ellipse: %d, ", params->semiminor_axis_external_ellipse); -av_log(ctx, AV_LOG_INFO, "overlap_process_option: %d}, ", +av_log(ctx, AV_LOG_INFO, "overlap_process_option: %d}", params->overlap_process_option); } av_log(ctx, AV_LOG_INFO, "targeted_system_display_maximum_luminance: %9.4f, ", @@ -252,7 +252,7 @@ static void dump_dynamic_hdr_plus(AVFilterContext *ctx, AVFrameSideData *sd) for (int i = 0; i < hdr_plus->num_rows_targeted_system_display_actual_peak_luminance; i++) { av_log(ctx, AV_LOG_INFO, "("); for (int j = 0; j < hdr_plus->num_cols_targeted_system_display_actual_peak_luminance; j++) { -av_log(ctx, AV_LOG_INFO, "%5.4f,", +av_log(ctx, AV_LOG_INFO, i ? ",%5.4f" : "%5.4f", av_q2d(hdr_plus->targeted_system_display_actual_peak_luminance[i][j])); } av_log(ctx, AV_LOG_INFO, ")"); @@ -264,9 +264,9 @@ static void dump_dynamic_hdr_plus(AVFilterContext *ctx, AVFrameSideData *sd) AVHDRPlusColorTransformParams *params = &hdr_plus->params[w]; av_log(ctx, AV_LOG_INFO, "window %d {maxscl: {", w); for (int i = 0; i < 3; i++) { -av_log(ctx, AV_LOG_INFO, "%5.4f,",av_q2d(params->maxscl[i])); +av_log(ctx, AV_LOG_INFO, i ? ",%5.4f" : "%5.4f",av_q2d(params->maxscl[i])); } -av_log(ctx, AV_LOG_INFO, "} average_maxrgb: %5.4f, ", +av_log(ctx, AV_LOG_INFO, "}, average_maxrgb: %5.4f, ", av_q2d(params->average_maxrgb)); av_log(ctx, AV_LOG_INFO, "distribution_maxrgb: {"); for (int i = 0; i < params->num_distribution_maxrgb_percentiles; i++) { @@ -274,35 +274,35 @@ static void dump_dynamic_hdr_plus(AVFilterContext *ctx, AVFrameSideData *sd) params->distribution_maxrgb[i].percentage, av_q2d(params->distribution_maxrgb[i].percentile)); } -av_log(ctx, AV_LOG_INFO, "} fraction_bright_pixels: %5.4f, ", +av_log(ctx, AV_LOG_INFO, "}, fraction_bright_pixels: %5.4f", av_q2d(params->fraction_bright_pixels)); if (params->tone_mapping_flag) { -av_log(ctx, AV_LOG_INFO, "knee_point: (%5.4f,%5.4f), ", av_q2d(params->knee_point_x), av_q2d(params->knee_point_y)); +av_log(ctx, AV_LOG_INFO, ", knee_point: (%5.4f,%5.4f), ", av_q2d(params->knee_point_x), av_q2d(params->knee_point_y)); av_log(ctx, AV_LOG_INFO, "bezier_curve_anchors: {"); for (int i = 0; i < params->num_bezier_curve_anchors; i++) { -av_log(ctx, AV_LOG_INFO, "%5.4f,", +av_log(ctx, AV_LOG_INFO, i ? ",%5.4f" : "%5.4f", av_q2d(params->bezier_curve_anchors[i])); } -av_log(ctx, AV_LOG_INFO, "} "); +av_log(ctx, AV_LOG_INFO, "}"); } if (params->color_saturation_mapping_flag) { -av_log(ctx, AV_LOG_INFO, "color_saturation_weight: %5.4f", +av_log(ctx, AV_LOG_INFO, ", color_saturation_weight: %5.4f", av_q2d(params->color_saturation_weight)); } -av_log(ctx, AV_LOG_INFO, "} "); +av_log(ctx, AV_LOG_INFO, "}"); } if (hdr_plus->mastering_display_actual_peak_luminance_flag) { -av_log(
[FFmpeg-devel] [PATCH 3/8] avcodec/hevc_sei: remove the duplicate check
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevc_sei.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 29d0346..7fd8226 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -181,9 +181,6 @@ static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB { int ret; -if (size < 3) - return AVERROR_INVALIDDATA; - ret = ff_parse_a53_cc(&s->buf_ref, gb->buffer + get_bits_count(gb) / 8, size); if (ret < 0) -- 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/8] avcodec/atsc_a53: use AVERROR_INVALIDDATA
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/atsc_a53.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/atsc_a53.c b/libavcodec/atsc_a53.c index 2d89ef5..29ec71b 100644 --- a/libavcodec/atsc_a53.c +++ b/libavcodec/atsc_a53.c @@ -73,7 +73,7 @@ int ff_parse_a53_cc(AVBufferRef **pbuf, const uint8_t *data, int size) int ret, cc_count; if (size < 3) -return AVERROR(EINVAL); +return AVERROR_INVALIDDATA; ret = init_get_bits8(&gb, data, size); if (ret < 0) @@ -95,12 +95,12 @@ int ff_parse_a53_cc(AVBufferRef **pbuf, const uint8_t *data, int size) /* 3 bytes per CC plus one byte marker_bits at the end */ if (cc_count * 3 >= (get_bits_left(&gb) >> 3)) -return AVERROR(EINVAL); +return AVERROR_INVALIDDATA; new_size = (old_size + cc_count * 3); if (new_size > INT_MAX) -return AVERROR(EINVAL); +return AVERROR_INVALIDDATA; /* Allow merging of the cc data from two fields. */ ret = av_buffer_realloc(pbuf, new_size); -- 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/8] avformat/mov: support dvwC box for Dolby Vision
From: Limin Wang By <> Signed-off-by: Limin Wang --- libavformat/mov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 57c67e3..49a8c27 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7074,7 +7074,7 @@ static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom) return ret; } -av_log(c, AV_LOG_TRACE, "DOVI in dvcC/dvvC box, version: %d.%d, profile: %d, level: %d, " +av_log(c, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, " "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", dovi->dv_version_major, dovi->dv_version_minor, dovi->dv_profile, dovi->dv_level, @@ -7273,6 +7273,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('c','l','l','i'), mov_read_clli }, { MKTAG('d','v','c','C'), mov_read_dvcc_dvvc }, { MKTAG('d','v','v','C'), mov_read_dvcc_dvvc }, +{ MKTAG('d','v','w','C'), mov_read_dvcc_dvvc }, { MKTAG('k','i','n','d'), mov_read_kind }, { 0, 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 6/8] avformat/movenc: support dvwC box for Dolby Vision
From: Limin Wang By <> Signed-off-by: Limin Wang --- libavformat/movenc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d43a086..37d4403 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1912,7 +1912,9 @@ static int mov_write_sv3d_tag(AVFormatContext *s, AVIOContext *pb, AVSphericalMa static int mov_write_dvcc_dvvc_tag(AVFormatContext *s, AVIOContext *pb, AVDOVIDecoderConfigurationRecord *dovi) { avio_wb32(pb, 32); /* size = 8 + 24 */ -if (dovi->dv_profile > 7) +if (dovi->dv_profile > 10) +ffio_wfourcc(pb, "dvwC"); +else if (dovi->dv_profile > 7) ffio_wfourcc(pb, "dvvC"); else ffio_wfourcc(pb, "dvcC"); @@ -1926,7 +1928,7 @@ static int mov_write_dvcc_dvvc_tag(AVFormatContext *s, AVIOContext *pb, AVDOVIDe ffio_fill(pb, 0, 4 * 4); /* reserved */ av_log(s, AV_LOG_DEBUG, "DOVI in %s box, version: %d.%d, profile: %d, level: %d, " "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", - dovi->dv_profile > 7 ? "dvvC" : "dvcC", + dovi->dv_profile > 10 ? "dvwC" : (dovi->dv_profile > 7 ? "dvvC" : "dvcC"), dovi->dv_version_major, dovi->dv_version_minor, dovi->dv_profile, dovi->dv_level, dovi->rpu_present_flag, -- 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 7/8] avformat/mpegts: Fix for the DOVI video stream descriptor
From: Limin Wang By <> Signed-off-by: Limin Wang --- libavformat/mpegts.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 44d9298..774964d 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2178,6 +2178,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type AVDOVIDecoderConfigurationRecord *dovi; size_t dovi_size; int ret; +int dependency_pid; + if (desc_end - *pp < 4) // (8 + 8 + 7 + 6 + 1 + 1 + 1) / 8 return AVERROR_INVALIDDATA; @@ -2193,7 +2195,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type dovi->rpu_present_flag = (buf >> 2) & 0x01;// 1 bit dovi->el_present_flag = (buf >> 1) & 0x01;// 1 bit dovi->bl_present_flag = buf & 0x01;// 1 bit -if (desc_end - *pp >= 20) { // 4 + 4 * 4 +if (!dovi->bl_present_flag && desc_end - *pp >= 2) { +buf = get16(pp, desc_end); +dependency_pid = buf >> 3; // 13 bits +} +if (desc_end - *pp >= 1) { // 8 bits buf = get8(pp, desc_end); dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; // 4 bits } else { @@ -2210,12 +2216,13 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type } av_log(fc, AV_LOG_TRACE, "DOVI, version: %d.%d, profile: %d, level: %d, " - "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", + "rpu flag: %d, el flag: %d, bl flag: %d, dependency_pid: %d, compatibility id: %d\n", dovi->dv_version_major, dovi->dv_version_minor, dovi->dv_profile, dovi->dv_level, dovi->rpu_present_flag, dovi->el_present_flag, dovi->bl_present_flag, + dependency_pid, dovi->dv_bl_signal_compatibility_id); } break; -- 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 8/8] avformat/mpegts: return proper error codes
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/mpegts.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 774964d..3157e3a 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2270,22 +2270,22 @@ static int parse_stream_identifier_desc(const uint8_t *p, const uint8_t *p_end) desc_list_len = get16(pp, p_end); if (desc_list_len < 0) -return -1; +return AVERROR_INVALIDDATA; desc_list_len &= 0xfff; desc_list_end = p + desc_list_len; if (desc_list_end > p_end) -return -1; +return AVERROR_INVALIDDATA; while (1) { desc_tag = get8(pp, desc_list_end); if (desc_tag < 0) -return -1; +return AVERROR_INVALIDDATA; desc_len = get8(pp, desc_list_end); if (desc_len < 0) -return -1; +return AVERROR_INVALIDDATA; desc_end = *pp + desc_len; if (desc_end > desc_list_end) -return -1; +return AVERROR_INVALIDDATA; if (desc_tag == 0x52) { return get8(pp, desc_end); @@ -2293,7 +2293,7 @@ static int parse_stream_identifier_desc(const uint8_t *p, const uint8_t *p_end) *pp = desc_end; } -return -1; +return AVERROR_INVALIDDATA; } static int is_pes_stream(int stream_type, uint32_t prog_reg_desc) -- 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 7/8] avformat/mpegts: Fix for the DOVI video stream descriptor
On Thu, Oct 14, 2021 at 09:18:16AM -0400, f tcChlisop0 wrote: > On Thu, Oct 14, 2021 at 9:10 AM wrote: > > > From: Limin Wang > > > > By <> > > > > Signed-off-by: Limin Wang > > --- > > libavformat/mpegts.c | 11 +-- > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > > index 44d9298..774964d 100644 > > --- a/libavformat/mpegts.c > > +++ b/libavformat/mpegts.c > > @@ -2178,6 +2178,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > > AVStream *st, int stream_type > > AVDOVIDecoderConfigurationRecord *dovi; > > size_t dovi_size; > > int ret; > > +int dependency_pid; > > + > > if (desc_end - *pp < 4) // (8 + 8 + 7 + 6 + 1 + 1 + 1) / 8 > > return AVERROR_INVALIDDATA; > > > > @@ -2193,7 +2195,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > > AVStream *st, int stream_type > > dovi->rpu_present_flag = (buf >> 2) & 0x01;// 1 bit > > dovi->el_present_flag = (buf >> 1) & 0x01;// 1 bit > > dovi->bl_present_flag = buf & 0x01;// 1 bit > > -if (desc_end - *pp >= 20) { // 4 + 4 * 4 > > +if (!dovi->bl_present_flag && desc_end - *pp >= 2) { > > +buf = get16(pp, desc_end); > > +dependency_pid = buf >> 3; // 13 bits > > +} > > +if (desc_end - *pp >= 1) { // 8 bits > > buf = get8(pp, desc_end); > > dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; > > // 4 bits > > } else { > > @@ -2210,12 +2216,13 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > > AVStream *st, int stream_type > > } > > > > av_log(fc, AV_LOG_TRACE, "DOVI, version: %d.%d, profile: %d, > > level: %d, " > > - "rpu flag: %d, el flag: %d, bl flag: %d, compatibility > > id: %d\n", > > + "rpu flag: %d, el flag: %d, bl flag: %d, > > dependency_pid: %d, compatibility id: %d\n", > > dovi->dv_version_major, dovi->dv_version_minor, > > dovi->dv_profile, dovi->dv_level, > > dovi->rpu_present_flag, > > dovi->el_present_flag, > > dovi->bl_present_flag, > > + dependency_pid, > > dovi->dv_bl_signal_compatibility_id); > > } > > break; > > -- > > 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". > > > > Hi, this is something I had fixed in this patchset: > https://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/286234.html > However the dependency_pid is ignored, as it has no use presently. > > Which patch should take precedence? Sorry, I have noticed your patch before. By the quick review of your patch, it's a lot function change and difficult to merge I think. I prefer to fix the issue with existing code first instead of mixed function change. > > thanks, quietvoid > ___ > 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 7/8] avformat/mpegts: Fix for the DOVI video stream descriptor
On Thu, Oct 14, 2021 at 09:45:45AM -0400, quietvoid wrote: > On Thu, Oct 14, 2021 at 9:36 AM wrote: > > > On Thu, Oct 14, 2021 at 09:18:16AM -0400, f tcChlisop0 wrote: > > > On Thu, Oct 14, 2021 at 9:10 AM wrote: > > > > > > > From: Limin Wang > > > > > > > > By < > v1.2>> > > > > > > > > Signed-off-by: Limin Wang > > > > --- > > > > libavformat/mpegts.c | 11 +-- > > > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > > > > index 44d9298..774964d 100644 > > > > --- a/libavformat/mpegts.c > > > > +++ b/libavformat/mpegts.c > > > > @@ -2178,6 +2178,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext > > *fc, > > > > AVStream *st, int stream_type > > > > AVDOVIDecoderConfigurationRecord *dovi; > > > > size_t dovi_size; > > > > int ret; > > > > +int dependency_pid; > > > > + > > > > if (desc_end - *pp < 4) // (8 + 8 + 7 + 6 + 1 + 1 + 1) / 8 > > > > return AVERROR_INVALIDDATA; > > > > > > > > @@ -2193,7 +2195,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext > > *fc, > > > > AVStream *st, int stream_type > > > > dovi->rpu_present_flag = (buf >> 2) & 0x01;// 1 bit > > > > dovi->el_present_flag = (buf >> 1) & 0x01;// 1 bit > > > > dovi->bl_present_flag = buf & 0x01;// 1 bit > > > > -if (desc_end - *pp >= 20) { // 4 + 4 * 4 > > > > +if (!dovi->bl_present_flag && desc_end - *pp >= 2) { > > > > +buf = get16(pp, desc_end); > > > > +dependency_pid = buf >> 3; // 13 bits > > > > +} > > > > +if (desc_end - *pp >= 1) { // 8 bits > > > > buf = get8(pp, desc_end); > > > > dovi->dv_bl_signal_compatibility_id = (buf >> 4) & > > 0x0f; > > > > // 4 bits > > > > } else { > > > > @@ -2210,12 +2216,13 @@ int ff_parse_mpeg2_descriptor(AVFormatContext > > *fc, > > > > AVStream *st, int stream_type > > > > } > > > > > > > > av_log(fc, AV_LOG_TRACE, "DOVI, version: %d.%d, profile: > > %d, > > > > level: %d, " > > > > - "rpu flag: %d, el flag: %d, bl flag: %d, > > compatibility > > > > id: %d\n", > > > > + "rpu flag: %d, el flag: %d, bl flag: %d, > > > > dependency_pid: %d, compatibility id: %d\n", > > > > dovi->dv_version_major, dovi->dv_version_minor, > > > > dovi->dv_profile, dovi->dv_level, > > > > dovi->rpu_present_flag, > > > > dovi->el_present_flag, > > > > dovi->bl_present_flag, > > > > + dependency_pid, > > > > dovi->dv_bl_signal_compatibility_id); > > > > } > > > > break; > > > > -- > > > > 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". > > > > > > > > > > Hi, this is something I had fixed in this patchset: > > > https://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/286234.html > > > However the dependency_pid is ignored, as it has no use presently. > > > > > > Which patch should take precedence? > > > > Sorry, I have noticed your patch before. By the quick review of your patch, > > it's a lot function change and difficult to merge I think. I prefer to > > fix the issue with existing code first instead of mixed function change. > > > > Okay, that makes sense. > I will wait and rebase before resending for review then. > > However I'm worried my patch will still result in ignoring dependency_pid, > because it is not part of AVDOVIDecoderConfigurationRecord, unless it is > added. I failed to find your patchset in my email archive, so I reply it here for my comments: -if (ret < 0) { -av_free(dovi); +if ((ret = ff_isom_parse_dvcc_dvvc(fc, st, *pp, desc_len, 1)) < 0) return ret; -} I think it's wrong to use ff_isom_parse_dvcc_dvvc() here for mpegts use DOVIVideoStreamDescriptor, ISOM use DOVIDecoderConfigurationRecord. they're different syntax if you have checked the two specs. So your parsing isn't follow the specs as dependency_pid is used by DOVIVideoStreamDescriptor. > > > > > > thanks, quietvoid > > > ___ > > > 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 > > ff
Re: [FFmpeg-devel] [PATCH 7/8] avformat/mpegts: Fix for the DOVI video stream descriptor
On Thu, Oct 14, 2021 at 10:12:05AM -0400, quietvoid wrote: > On Thu, Oct 14, 2021 at 9:52 AM wrote: > > > On Thu, Oct 14, 2021 at 09:45:45AM -0400, quietvoid wrote: > > > On Thu, Oct 14, 2021 at 9:36 AM wrote: > > > > > > > On Thu, Oct 14, 2021 at 09:18:16AM -0400, f tcChlisop0 wrote: > > > > > On Thu, Oct 14, 2021 at 9:10 AM wrote: > > > > > > > > > > > From: Limin Wang > > > > > > > > > > > > By < > > > v1.2>> > > > > > > > > > > > > Signed-off-by: Limin Wang > > > > > > --- > > > > > > libavformat/mpegts.c | 11 +-- > > > > > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > > > > > > > > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > > > > > > index 44d9298..774964d 100644 > > > > > > --- a/libavformat/mpegts.c > > > > > > +++ b/libavformat/mpegts.c > > > > > > @@ -2178,6 +2178,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext > > > > *fc, > > > > > > AVStream *st, int stream_type > > > > > > AVDOVIDecoderConfigurationRecord *dovi; > > > > > > size_t dovi_size; > > > > > > int ret; > > > > > > +int dependency_pid; > > > > > > + > > > > > > if (desc_end - *pp < 4) // (8 + 8 + 7 + 6 + 1 + 1 + > > 1) / 8 > > > > > > return AVERROR_INVALIDDATA; > > > > > > > > > > > > @@ -2193,7 +2195,11 @@ int > > ff_parse_mpeg2_descriptor(AVFormatContext > > > > *fc, > > > > > > AVStream *st, int stream_type > > > > > > dovi->rpu_present_flag = (buf >> 2) & 0x01;// 1 > > bit > > > > > > dovi->el_present_flag = (buf >> 1) & 0x01;// 1 > > bit > > > > > > dovi->bl_present_flag = buf & 0x01;// 1 > > bit > > > > > > -if (desc_end - *pp >= 20) { // 4 + 4 * 4 > > > > > > +if (!dovi->bl_present_flag && desc_end - *pp >= 2) { > > > > > > +buf = get16(pp, desc_end); > > > > > > +dependency_pid = buf >> 3; // 13 bits > > > > > > +} > > > > > > +if (desc_end - *pp >= 1) { // 8 bits > > > > > > buf = get8(pp, desc_end); > > > > > > dovi->dv_bl_signal_compatibility_id = (buf >> 4) & > > > > 0x0f; > > > > > > // 4 bits > > > > > > } else { > > > > > > @@ -2210,12 +2216,13 @@ int > > ff_parse_mpeg2_descriptor(AVFormatContext > > > > *fc, > > > > > > AVStream *st, int stream_type > > > > > > } > > > > > > > > > > > > av_log(fc, AV_LOG_TRACE, "DOVI, version: %d.%d, > > profile: > > > > %d, > > > > > > level: %d, " > > > > > > - "rpu flag: %d, el flag: %d, bl flag: %d, > > > > compatibility > > > > > > id: %d\n", > > > > > > + "rpu flag: %d, el flag: %d, bl flag: %d, > > > > > > dependency_pid: %d, compatibility id: %d\n", > > > > > > dovi->dv_version_major, dovi->dv_version_minor, > > > > > > dovi->dv_profile, dovi->dv_level, > > > > > > dovi->rpu_present_flag, > > > > > > dovi->el_present_flag, > > > > > > dovi->bl_present_flag, > > > > > > + dependency_pid, > > > > > > dovi->dv_bl_signal_compatibility_id); > > > > > > } > > > > > > break; > > > > > > -- > > > > > > 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". > > > > > > > > > > > > > > > > Hi, this is something I had fixed in this patchset: > > > > > https://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/286234.html > > > > > However the dependency_pid is ignored, as it has no use presently. > > > > > > > > > > Which patch should take precedence? > > > > > > > > Sorry, I have noticed your patch before. By the quick review of your > > patch, > > > > it's a lot function change and difficult to merge I think. I prefer to > > > > fix the issue with existing code first instead of mixed function > > change. > > > > > > > > > > Okay, that makes sense. > > > I will wait and rebase before resending for review then. > > > > > > However I'm worried my patch will still result in ignoring > > dependency_pid, > > > because it is not part of AVDOVIDecoderConfigurationRecord, unless it is > > > added. > > > > I failed to find your patchset in my email archive, so I reply it here for > > my comments: > > -if (ret < 0) { > > -av_free(dovi); > > +if ((ret = ff_isom_parse_dvcc_dvvc(fc, st, *pp, desc_len, 1)) > > < 0) > > return ret; > > -} > > > > I think it's wrong to use ff_isom_parse_dvcc_dvvc() here for mpegts > > use DOVIVideoStreamDescriptor, ISOM use DOVIDecoderConfigurationRecord. > > they're different syn
Re: [FFmpeg-devel] [PATCH 8/8] avformat/mpegts: return proper error codes
On Thu, Oct 14, 2021 at 09:46:37PM +0200, Marton Balint wrote: > > > On Thu, 14 Oct 2021, lance.lmw...@gmail.com wrote: > > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavformat/mpegts.c | 12 ++-- > > 1 file changed, 6 insertions(+), 6 deletions(-) > > No, parse_stream_identifier_desc intentionally returns -1 for error, check > how the code works which uses the function. Sorry, please ignore the patch. Anyway, it's error, but the current ignore it with a hacky. > > Regards, > Marton > > > > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > > index 774964d..3157e3a 100644 > > --- a/libavformat/mpegts.c > > +++ b/libavformat/mpegts.c > > @@ -2270,22 +2270,22 @@ static int parse_stream_identifier_desc(const > > uint8_t *p, const uint8_t *p_end) > > > > desc_list_len = get16(pp, p_end); > > if (desc_list_len < 0) > > -return -1; > > +return AVERROR_INVALIDDATA; > > desc_list_len &= 0xfff; > > desc_list_end = p + desc_list_len; > > if (desc_list_end > p_end) > > -return -1; > > +return AVERROR_INVALIDDATA; > > > > while (1) { > > desc_tag = get8(pp, desc_list_end); > > if (desc_tag < 0) > > -return -1; > > +return AVERROR_INVALIDDATA; > > desc_len = get8(pp, desc_list_end); > > if (desc_len < 0) > > -return -1; > > +return AVERROR_INVALIDDATA; > > desc_end = *pp + desc_len; > > if (desc_end > desc_list_end) > > -return -1; > > +return AVERROR_INVALIDDATA; > > > > if (desc_tag == 0x52) { > > return get8(pp, desc_end); > > @@ -2293,7 +2293,7 @@ static int parse_stream_identifier_desc(const uint8_t > > *p, const uint8_t *p_end) > > *pp = desc_end; > > } > > > > -return -1; > > +return AVERROR_INVALIDDATA; > > } > > > > static int is_pes_stream(int stream_type, uint32_t prog_reg_desc) > > -- > > 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 5/8] avformat/mov: support dvwC box for Dolby Vision
On Fri, Oct 15, 2021 at 04:40:26PM +0800, myp...@gmail.com wrote: > On Thu, Oct 14, 2021 at 9:10 PM wrote: > > > > From: Limin Wang > > > > By < > 2.2>> > > > > Signed-off-by: Limin Wang > > --- > > libavformat/mov.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > index 57c67e3..49a8c27 100644 > > --- a/libavformat/mov.c > > +++ b/libavformat/mov.c > > @@ -7074,7 +7074,7 @@ static int mov_read_dvcc_dvvc(MOVContext *c, > > AVIOContext *pb, MOVAtom atom) > > return ret; > > } > > > > -av_log(c, AV_LOG_TRACE, "DOVI in dvcC/dvvC box, version: %d.%d, > > profile: %d, level: %d, " > > +av_log(c, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, > > profile: %d, level: %d, " > > "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: > > %d\n", > > dovi->dv_version_major, dovi->dv_version_minor, > > dovi->dv_profile, dovi->dv_level, > > @@ -7273,6 +7273,7 @@ static const MOVParseTableEntry > > mov_default_parse_table[] = { > > { MKTAG('c','l','l','i'), mov_read_clli }, > > { MKTAG('d','v','c','C'), mov_read_dvcc_dvvc }, > > { MKTAG('d','v','v','C'), mov_read_dvcc_dvvc }, > > +{ MKTAG('d','v','w','C'), mov_read_dvcc_dvvc }, > > { MKTAG('k','i','n','d'), mov_read_kind }, > > { 0, NULL } > > }; > > -- > > 1.8.3.1 > Do you have test clip for this patch? I tested with created sample with the mov muxer in the patchset. I haven't saw such sample released by dolby. -- 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 1/8] avfilter/af_replaygain: use fabsf() instead of fabs()
On Sat, Oct 16, 2021 at 10:06:35AM -0300, James Almer wrote: > On 10/14/2021 10:08 AM, lance.lmw...@gmail.com wrote: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavfilter/af_replaygain.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c > > index 4bf2763..da5c196 100644 > > --- a/libavfilter/af_replaygain.c > > +++ b/libavfilter/af_replaygain.c > > @@ -428,7 +428,7 @@ static void > > butter_filter_stereo_samples(ReplayGainContext *s, > > // (slowing us down). > > for (j = -4; j < 0; ++j) > > -if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10) > > +if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10) > > Shouldn't the constants also be made into floats? Otherwise the compiler > will probably do a conversion to double. Yes, will change the 1e-10 to 1e-10f also. > > > break; > > if (!j) { > > @@ -477,7 +477,7 @@ static void > > yule_filter_stereo_samples(ReplayGainContext *s, const float *src, > > // (slowing us down). > > for (j = -20; j < 0; ++j) > > -if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10) > > +if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10) > > break; > > if (!j) { > > > > ___ > 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] libavformat/rtpdec_mpeg: handle bare ADTS packets with explicit decoder config
On Fri, Oct 01, 2021 at 06:53:23PM -0400, Jeff Mahoney wrote: > When SDP specifies a decoder config, there may not be any AU headers > provided by the sender. This can result in rtp_parse_mp4_au failing > and aac_parse_packet reporting "Error parsing AU headers." and no audio > is recovered from the stream. > > This commit modifies aac_parse_header to check for an explicit decoder config > set by the sdp parser (e.g. a:fmtp # config=hexvalue). If it has and there > is an ADTS header present, it skips the header and copies the RTP > payload directly as an AAC packet. > > This resolves an issue observed with some inexpensive IP cameras. > > Signed-off-by: Jeff Mahoney > --- > libavformat/rtpdec_mpeg4.c | 34 +- > 1 file changed, 33 insertions(+), 1 deletion(-) > > diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c > index 34c7950bcc..dd0ced790e 100644 > --- a/libavformat/rtpdec_mpeg4.c > +++ b/libavformat/rtpdec_mpeg4.c > @@ -176,7 +176,7 @@ static int aac_parse_packet(AVFormatContext *ctx, > PayloadContext *data, > int flags) > { > int ret; > - > +AVCodecParameters *par = st->codecpar; > > if (!buf) { > if (data->cur_au_index > data->nb_au_headers) { > @@ -204,6 +204,38 @@ static int aac_parse_packet(AVFormatContext *ctx, > PayloadContext *data, > return 1; > } > > +/* Check for an explicit decoder config (e.g. SDP a:fmtp... config=) */ > +if (par->extradata && len > 7) { > +/* > + * Start of ADTS header - syncword > + * If present skip the header and copy the entire payload as AAC data > + */ > +if (buf[0] == 0xff && (buf[1] & 0xf0) == 0xf0) { > +/* > + * The ADTS header is 7 or 9 bytes depending on whether > + * the protection absent bit is set. If it is unset, a 16-bit > CRC > + * is appended to the header. > + */ > +size_t header_size = 7 + ((buf[1] & 0x01) ? 0 : 2); > +if (len < header_size) { > +ac_log(ctx, AV_LOG_ERROR, "Error parsing ADTS header\n"); > +return -1; > +} I prefer to use avpriv_adts_header_parse() for ADTS header parse. > + > +buf += header_size; > +len -= header_size; > + > +if ((ret = av_new_packet(pkt, len)) < 0) { > +av_log(ctx, AV_LOG_ERROR, "Out of memory\n"); > +return ret; > +} > +memcpy(pkt->data, buf, len); > +pkt->stream_index = st->index; > + > +return 0; > +} > +} > + > if (rtp_parse_mp4_au(data, buf, len)) { > av_log(ctx, AV_LOG_ERROR, "Error parsing AU headers\n"); > return -1; > -- > 2.33.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". -- 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] [FFmpeg-cvslog] libavcodec/libx264: add user data unregistered SEI encoding
On Tue, Oct 19, 2021 at 12:05:19AM +0200, Michael Niedermayer wrote: > Hi > > On Mon, Oct 18, 2021 at 12:15:11PM +, Brad Hards wrote: > > ffmpeg | branch: master | Brad Hards | Fri Aug 6 > > 19:16:33 2021 +1000| [7c08cad280a16b346c0a5e0efdfd8333ec54f095] | > > committer: Derek Buitenhuis > > > > libavcodec/libx264: add user data unregistered SEI encoding > > > > MISB ST 0604 and ST 2101 require user data unregistered SEI messages > > (precision timestamps and sensor identifiers) to be included. That > > currently isn't supported for libx264. This patch adds support > > for user data unregistered SEI messages in accordance with ISO/IEC > > 14496-10:2020(E) section D.1.7 (syntax) and D.2.7 (semantics). > > > > This code is based on a similar change for libx265 (commit > > 1f58503013720700a5adfd72c708e6275aefc165). > > > > Signed-off-by: Derek Buitenhuis > > > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c08cad280a16b346c0a5e0efdfd8333ec54f095 > > --- > > This code breaks bitexact mode for some files, i have not looked into this > any deeper yet. > > example: > ./ffmpeg -i tickets/5356/framestep_fails.mov -map 0:v:0 -filter:v > "framestep=step=2" -codec:v libx264 -t 0.1 -an -bitexact -y file5414.mp4 && > md5sum file5414.mp4 > 59441c644fc3d269ef6689f1c450abda file5414.mp4 > 62740d54583fd475efd808a638730c1e file5414.mp4 > > > #extradata 0: 49, 0xb4861385 > #software: Lavf59.6.100 > #tb 0: 1/15000 > #media_type 0: video > #codec_id 0: h264 > #dimensions 0: 1920x1080 > #sar 0: 0/1 > 0, 0, 0, 1001, 1879, 0x2fd508ad > 0, 1001, 1001, 1001,13178, 0xfe8c5a6b, F=0x0 > > #extradata 0: 49, 0xb4861385 > #software: Lavf59.6.100 > #tb 0: 1/15000 > #media_type 0: video > #codec_id 0: h264 > #dimensions 0: 1920x1080 > #sar 0: 0/1 > 0, 0, 0, 1001, 1879, 0x67fb0880 > 0, 1001, 1001, 1001,13178, 0xf33a5a3e, F=0x0 > > #extradata 0: 49, 0xb4861385 > #software: Lavf59.6.100 > #tb 0: 1/15000 > #media_type 0: video > #codec_id 0: h264 > #dimensions 0: 1920x1080 > #sar 0: 0/1 > 0, 0, 0, 1001, 1879, 0xb39a0891 > 0, 1001, 1001, 1001,13178, 0x5e155a4f, F=0x0 > > Heres another examples: > ./ffmpeg -i tickets/4012/IMG_4596.MOV -movflags +faststart -pix_fmt yuv420p > -c:v libx264 -c:a aac -bitexact -t 0.5 -vprofile baseline -acodec aac -y > test.mov && md5sum test.mov > the link to the sample file is on: > https://trac.ffmpeg.org/ticket/4012 The current code will pass throught the unregistered user data default, so if input have UUD, I'll cause it. > > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Into a blind darkness they enter who follow after the Ignorance, > they as if into a greater darkness enter who devote themselves > to the Knowledge alone. -- Isha Upanishad > ___ > 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] [PATCH 1/2] configure: add hls demuxer link dependencies
From: Limin Wang Fixes building with --disable-everything --enable-demuxer=hls Signed-off-by: Limin Wang --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 92610c7..0fe3937 100755 --- a/configure +++ b/configure @@ -3363,6 +3363,7 @@ flac_demuxer_select="flac_parser" flv_muxer_select="aac_adtstoasc_bsf" gxf_muxer_select="pcm_rechunk_bsf" hds_muxer_select="flv_muxer" +hls_demuxer_select="adts_header ac3_parser" hls_muxer_select="mpegts_muxer" hls_muxer_suggest="gcrypt openssl" image2_alias_pix_demuxer_select="image2_demuxer" -- 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/2] avutil/hwcontext_videotoolbox: fix use of unknown builtin '__builtin_available'
From: Limin Wang OSX version: 10.11.6 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Signed-off-by: Limin Wang --- libavutil/hwcontext_videotoolbox.c | 12 1 file changed, 12 insertions(+) diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index 58095a1..5794cab 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -375,9 +375,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->colorspace) { case AVCOL_SPC_BT2020_CL: case AVCOL_SPC_BT2020_NCL: +#if __has_builtin(__builtin_available) if (__builtin_available(macOS 10.11, *)) colormatrix = kCVImageBufferYCbCrMatrix_ITU_R_2020; else +#endif colormatrix = CFSTR("ITU_R_2020"); break; case AVCOL_SPC_BT470BG: @@ -398,9 +400,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->color_primaries) { case AVCOL_PRI_BT2020: +#if __has_builtin(__builtin_available) if (__builtin_available(macOS 10.11, *)) colorpri = kCVImageBufferColorPrimaries_ITU_R_2020; else +#endif colorpri = CFSTR("ITU_R_2020"); break; case AVCOL_PRI_BT709: @@ -420,16 +424,20 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->color_trc) { case AVCOL_TRC_SMPTE2084: +#if __has_builtin(__builtin_available) if (__builtin_available(macOS 10.13, *)) colortrc = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ; else +#endif colortrc = CFSTR("SMPTE_ST_2084_PQ"); break; case AVCOL_TRC_BT2020_10: case AVCOL_TRC_BT2020_12: +#if __has_builtin(__builtin_available) if (__builtin_available(macOS 10.11, *)) colortrc = kCVImageBufferTransferFunction_ITU_R_2020; else +#endif colortrc = CFSTR("ITU_R_2020"); break; case AVCOL_TRC_BT709: @@ -439,15 +447,19 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, colortrc = kCVImageBufferTransferFunction_SMPTE_240M_1995; break; case AVCOL_TRC_SMPTE428: +#if __has_builtin(__builtin_available) if (__builtin_available(macOS 10.12, *)) colortrc = kCVImageBufferTransferFunction_SMPTE_ST_428_1; else +#endif colortrc = CFSTR("SMPTE_ST_428_1"); break; case AVCOL_TRC_ARIB_STD_B67: +#if __has_builtin(__builtin_available) if (__builtin_available(macOS 10.13, *)) colortrc = kCVImageBufferTransferFunction_ITU_R_2100_HLG; else +#endif colortrc = CFSTR("ITU_R_2100_HLG"); break; case AVCOL_TRC_GAMMA22: -- 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 v2] libavformat/rtpdec_mpeg: handle bare ADTS packets with explicit decoder config
On Tue, Oct 19, 2021 at 05:02:44PM -0400, Jeff Mahoney wrote: The title should be "avformat/rtpdec_mpeg4: ..." > When SDP specifies a decoder config, there may not be any AU headers > provided by the sender. This can result in rtp_parse_mp4_au failing > and aac_parse_packet reporting "Error parsing AU headers." and no audio > is recovered from the stream. > > This commit modifies aac_parse_header to check for an explicit decoder config > set by the sdp parser (e.g. a:fmtp # config=hexvalue). If it has and there > is an ADTS header present, it skips the header and copies the RTP > payload directly as an AAC packet. > > This resolves an issue observed with some inexpensive IP cameras. How to test the issue without such IP cameras? > > Signed-off-by: Jeff Mahoney > --- > libavformat/rtpdec_mpeg4.c | 37 - > 1 file changed, 36 insertions(+), 1 deletion(-) > > diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c > index 34c7950bcc..13d0770dd6 100644 > --- a/libavformat/rtpdec_mpeg4.c > +++ b/libavformat/rtpdec_mpeg4.c > @@ -32,6 +32,8 @@ > #include "libavutil/attributes.h" > #include "libavutil/avstring.h" > #include "libavcodec/get_bits.h" > +#include "libavcodec/adts_header.h" > +#include "libavcodec/adts_parser.h" > > #define MAX_AAC_HBR_FRAME_SIZE 8191 > > @@ -176,7 +178,7 @@ static int aac_parse_packet(AVFormatContext *ctx, > PayloadContext *data, > int flags) > { > int ret; > - > +AVCodecParameters *par = st->codecpar; > > if (!buf) { > if (data->cur_au_index > data->nb_au_headers) { > @@ -204,6 +206,39 @@ static int aac_parse_packet(AVFormatContext *ctx, > PayloadContext *data, > return 1; > } > > +/* Check for an explicit decoder config (e.g. SDP a:fmtp... config=) */ > +if (par->extradata && len > 7) { 7 is better to use AV_AAC_ADTS_HEADER_SIZE like the following. > +AACADTSHeaderInfo *header; > + > +/* > + * Check for ADTS header > + * If present skip the header and copy the entire payload as AAC data > + */ > +ret = avpriv_adts_header_parse(&header, buf, len); need add adts_header dependency for rtp demuer. > +if (!ret) { > +buf += AV_AAC_ADTS_HEADER_SIZE; > +len -= AV_AAC_ADTS_HEADER_SIZE; > + > +/* Skip 16-bit CRC if present */ > +if (!header->crc_absent) { > +buf += 2; > +len -= 2; > +} > +av_free(header); > + > +ret = av_new_packet(pkt, len); > +if (ret < 0) { > +av_log(ctx, AV_LOG_ERROR, "Out of memory\n"); > +return ret; > +} > + > +memcpy(pkt->data, buf, len); > +pkt->stream_index = st->index; > + > +return 0; > +} > +} > + > if (rtp_parse_mp4_au(data, buf, len)) { > av_log(ctx, AV_LOG_ERROR, "Error parsing AU headers\n"); > return -1; > -- > 2.33.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". -- 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 7/8] avformat/mpegts: Fix for the DOVI video stream descriptor
On Thu, Oct 14, 2021 at 09:09:01PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > By <> > > Signed-off-by: Limin Wang > --- > libavformat/mpegts.c | 11 +-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > index 44d9298..774964d 100644 > --- a/libavformat/mpegts.c > +++ b/libavformat/mpegts.c > @@ -2178,6 +2178,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > AVStream *st, int stream_type > AVDOVIDecoderConfigurationRecord *dovi; > size_t dovi_size; > int ret; > +int dependency_pid; > + > if (desc_end - *pp < 4) // (8 + 8 + 7 + 6 + 1 + 1 + 1) / 8 > return AVERROR_INVALIDDATA; > > @@ -2193,7 +2195,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > AVStream *st, int stream_type > dovi->rpu_present_flag = (buf >> 2) & 0x01;// 1 bit > dovi->el_present_flag = (buf >> 1) & 0x01;// 1 bit > dovi->bl_present_flag = buf & 0x01;// 1 bit > -if (desc_end - *pp >= 20) { // 4 + 4 * 4 > +if (!dovi->bl_present_flag && desc_end - *pp >= 2) { > +buf = get16(pp, desc_end); > +dependency_pid = buf >> 3; // 13 bits > +} > +if (desc_end - *pp >= 1) { // 8 bits > buf = get8(pp, desc_end); > dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; // > 4 bits > } else { > @@ -2210,12 +2216,13 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > AVStream *st, int stream_type > } > > av_log(fc, AV_LOG_TRACE, "DOVI, version: %d.%d, profile: %d, > level: %d, " > - "rpu flag: %d, el flag: %d, bl flag: %d, compatibility > id: %d\n", > + "rpu flag: %d, el flag: %d, bl flag: %d, dependency_pid: > %d, compatibility id: %d\n", > dovi->dv_version_major, dovi->dv_version_minor, > dovi->dv_profile, dovi->dv_level, > dovi->rpu_present_flag, > dovi->el_present_flag, > dovi->bl_present_flag, > + dependency_pid, > dovi->dv_bl_signal_compatibility_id); > } > break; > -- > 1.8.3.1 > will apply patch#5,#6,#7 tomorrow unless there are objections. -- 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 7/8] avformat/mpegts: Fix for the DOVI video stream descriptor
On Wed, Oct 27, 2021 at 11:50:04AM +0300, Jan Ekström wrote: > On Thu, Oct 14, 2021 at 5:31 PM wrote: > > > > On Thu, Oct 14, 2021 at 10:12:05AM -0400, quietvoid wrote: > > > On Thu, Oct 14, 2021 at 9:52 AM wrote: > > > > > > > On Thu, Oct 14, 2021 at 09:45:45AM -0400, quietvoid wrote: > > > > > On Thu, Oct 14, 2021 at 9:36 AM wrote: > > > > > > > > > > > On Thu, Oct 14, 2021 at 09:18:16AM -0400, f tcChlisop0 wrote: > > > > > > > On Thu, Oct 14, 2021 at 9:10 AM wrote: > > > > > > > > > > > > > > > From: Limin Wang > > > > > > > > > > > > > > > > By < > > > > > > > Format > > > > > > v1.2>> > > > > > > > > > > > > > > > > Signed-off-by: Limin Wang > > > > > > > > --- > > > > > > > > libavformat/mpegts.c | 11 +-- > > > > > > > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > > > > > > > > > > > > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > > > > > > > > index 44d9298..774964d 100644 > > > > > > > > --- a/libavformat/mpegts.c > > > > > > > > +++ b/libavformat/mpegts.c > > > > > > > > @@ -2178,6 +2178,8 @@ int > > > > > > > > ff_parse_mpeg2_descriptor(AVFormatContext > > > > > > *fc, > > > > > > > > AVStream *st, int stream_type > > > > > > > > AVDOVIDecoderConfigurationRecord *dovi; > > > > > > > > size_t dovi_size; > > > > > > > > int ret; > > > > > > > > +int dependency_pid; > > > > > > > > + > > > > > > > > if (desc_end - *pp < 4) // (8 + 8 + 7 + 6 + 1 + 1 + > > > > 1) / 8 > > > > > > > > return AVERROR_INVALIDDATA; > > > > > > > > > > > > > > > > @@ -2193,7 +2195,11 @@ int > > > > ff_parse_mpeg2_descriptor(AVFormatContext > > > > > > *fc, > > > > > > > > AVStream *st, int stream_type > > > > > > > > dovi->rpu_present_flag = (buf >> 2) & 0x01;// > > > > > > > > 1 > > > > bit > > > > > > > > dovi->el_present_flag = (buf >> 1) & 0x01;// > > > > > > > > 1 > > > > bit > > > > > > > > dovi->bl_present_flag = buf & 0x01;// > > > > > > > > 1 > > > > bit > > > > > > > > -if (desc_end - *pp >= 20) { // 4 + 4 * 4 > > > > > > > > +if (!dovi->bl_present_flag && desc_end - *pp >= 2) > > > > > > > > { > > > > > > > > +buf = get16(pp, desc_end); > > > > > > > > +dependency_pid = buf >> 3; // 13 bits > > > > > > > > +} > > > > > > > > +if (desc_end - *pp >= 1) { // 8 bits > > > > > > > > buf = get8(pp, desc_end); > > > > > > > > dovi->dv_bl_signal_compatibility_id = (buf >> > > > > > > > > 4) & > > > > > > 0x0f; > > > > > > > > // 4 bits > > > > > > > > } else { > > > > > > > > @@ -2210,12 +2216,13 @@ int > > > > ff_parse_mpeg2_descriptor(AVFormatContext > > > > > > *fc, > > > > > > > > AVStream *st, int stream_type > > > > > > > > } > > > > > > > > > > > > > > > > av_log(fc, AV_LOG_TRACE, "DOVI, version: %d.%d, > > > > profile: > > > > > > %d, > > > > > > > > level: %d, " > > > > > > > > - "rpu flag: %d, el flag: %d, bl flag: %d, > > > > > > compatibility > > > > > > > > id: %d\n", > > > > > > > > + "rpu flag: %d, el flag: %d, bl flag: %d, > > > > > > > > dependency_pid: %d, compatibility id: %d\n", > > > > > > > > dovi->dv_version_major, > > > > > > > > dovi->dv_version_minor, > > > > > > > > dovi->dv_profile, dovi->dv_level, > > > > > > > > dovi->rpu_present_flag, > > > > > > > > dovi->el_present_flag, > > > > > > > > dovi->bl_present_flag, > > > > > > > > + dependency_pid, > > > > > > > > dovi->dv_bl_signal_compatibility_id); > > > > > > > > } > > > > > > > > break; > > > > > > > > -- > > > > > > > > 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". > > > > > > > > > > > > > > > > > > > > > > Hi, this is something I had fixed in this patchset: > > > > > > > https://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/286234.html > > > > > > > However the dependency_pid is ignored, as it has no use presently. > > > > > > > > > > > > > > Which patch should take precedence? > > > > > > > > > > > > Sorry, I have noticed your patch before. By the quick review of your > > > > patch, > > > > > > it's a lot function change and difficult to merge I think. I prefer > > > > > > to > > > > > > fix the issue with existing code first instead of mixed function > > > > change. > > > > > > > > > > > > > > > > Okay, that makes sense. > > > > > I will wait and rebase before resend
[FFmpeg-devel] [PATCH 1/2] avutil/parseutils: add qhd(Quad HD) or wqhd(Wide Quad HD) for 1440p
From: Limin Wang Signed-off-by: Limin Wang --- libavutil/parseutils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index 7f678cd..19bbdde 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -102,6 +102,7 @@ static const VideoSizeAbbr video_size_abbrs[] = { { "wsxga",1600,1024 }, { "wuxga",1920,1200 }, { "woxga",2560,1600 }, +{ "wqhd", 2560,1440 }, { "wqsxga", 3200,2048 }, { "wquxga", 3840,2400 }, { "whsxga", 6400,4096 }, @@ -111,6 +112,7 @@ static const VideoSizeAbbr video_size_abbrs[] = { { "hd480", 852, 480 }, { "hd720",1280, 720 }, { "hd1080", 1920,1080 }, +{ "qhd", 2560,1440 }, { "2k", 2048,1080 }, /* Digital Cinema System Specification */ { "2kdci",2048,1080 }, { "2kflat", 1998,1080 }, -- 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/2] avformat/dashenc: Fix comparing double with 0
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/dashenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 06bbf36..94e77c7 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -551,7 +551,7 @@ static void write_hls_media_playlist(OutputStream *os, AVFormatContext *s, for (i = start_index; i < os->nb_segments; i++) { Segment *seg = os->segments[i]; -if (prog_date_time == 0) { +if (fabs(prog_date_time) < 1e-7) { if (os->nb_segments == 1) prog_date_time = c->start_time_s; else -- 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 7/8] avformat/mpegts: Fix for the DOVI video stream descriptor
On Wed, Oct 27, 2021 at 10:54:31AM -0400, quietvoid wrote: > On Wed, Oct 27, 2021 at 10:26 AM wrote: > > > On Wed, Oct 27, 2021 at 11:50:04AM +0300, Jan Ekström wrote: > > > On Thu, Oct 14, 2021 at 5:31 PM wrote: > > > > > > > > On Thu, Oct 14, 2021 at 10:12:05AM -0400, quietvoid wrote: > > > > > On Thu, Oct 14, 2021 at 9:52 AM wrote: > > > > > > > > > > > On Thu, Oct 14, 2021 at 09:45:45AM -0400, quietvoid wrote: > > > > > > > On Thu, Oct 14, 2021 at 9:36 AM wrote: > > > > > > > > > > > > > > > On Thu, Oct 14, 2021 at 09:18:16AM -0400, f tcChlisop0 wrote: > > > > > > > > > On Thu, Oct 14, 2021 at 9:10 AM > > wrote: > > > > > > > > > > > > > > > > > > > From: Limin Wang > > > > > > > > > > > > > > > > > > > > By < > Stream Format > > > > > > > > v1.2>> > > > > > > > > > > > > > > > > > > > > Signed-off-by: Limin Wang > > > > > > > > > > --- > > > > > > > > > > libavformat/mpegts.c | 11 +-- > > > > > > > > > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > > > > > > > > > > > > > > > > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > > > > > > > > > > index 44d9298..774964d 100644 > > > > > > > > > > --- a/libavformat/mpegts.c > > > > > > > > > > +++ b/libavformat/mpegts.c > > > > > > > > > > @@ -2178,6 +2178,8 @@ int > > ff_parse_mpeg2_descriptor(AVFormatContext > > > > > > > > *fc, > > > > > > > > > > AVStream *st, int stream_type > > > > > > > > > > AVDOVIDecoderConfigurationRecord *dovi; > > > > > > > > > > size_t dovi_size; > > > > > > > > > > int ret; > > > > > > > > > > +int dependency_pid; > > > > > > > > > > + > > > > > > > > > > if (desc_end - *pp < 4) // (8 + 8 + 7 + 6 + 1 > > + 1 + > > > > > > 1) / 8 > > > > > > > > > > return AVERROR_INVALIDDATA; > > > > > > > > > > > > > > > > > > > > @@ -2193,7 +2195,11 @@ int > > > > > > ff_parse_mpeg2_descriptor(AVFormatContext > > > > > > > > *fc, > > > > > > > > > > AVStream *st, int stream_type > > > > > > > > > > dovi->rpu_present_flag = (buf >> 2) & 0x01; > > // 1 > > > > > > bit > > > > > > > > > > dovi->el_present_flag = (buf >> 1) & 0x01; > > // 1 > > > > > > bit > > > > > > > > > > dovi->bl_present_flag = buf & 0x01; > > // 1 > > > > > > bit > > > > > > > > > > -if (desc_end - *pp >= 20) { // 4 + 4 * 4 > > > > > > > > > > +if (!dovi->bl_present_flag && desc_end - *pp > > >= 2) { > > > > > > > > > > +buf = get16(pp, desc_end); > > > > > > > > > > +dependency_pid = buf >> 3; // 13 bits > > > > > > > > > > +} > > > > > > > > > > +if (desc_end - *pp >= 1) { // 8 bits > > > > > > > > > > buf = get8(pp, desc_end); > > > > > > > > > > dovi->dv_bl_signal_compatibility_id = > > (buf >> 4) & > > > > > > > > 0x0f; > > > > > > > > > > // 4 bits > > > > > > > > > > } else { > > > > > > > > > > @@ -2210,12 +2216,13 @@ int > > > > > > ff_parse_mpeg2_descriptor(AVFormatContext > > > > > > > > *fc, > > > > > > > > > > AVStream *st, int stream_type > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > av_log(fc, AV_LOG_TRACE, "DOVI, version: > > %d.%d, > > > > > > profile: > > > > > > > > %d, > > > > > > > > > > level: %d, " > > > > > > > > > > - "rpu flag: %d, el flag: %d, bl flag: > > %d, > > > > > > > > compatibility > > > > > > > > > > id: %d\n", > > > > > > > > > > + "rpu flag: %d, el flag: %d, bl flag: > > %d, > > > > > > > > > > dependency_pid: %d, compatibility id: %d\n", > > > > > > > > > > dovi->dv_version_major, > > dovi->dv_version_minor, > > > > > > > > > > dovi->dv_profile, dovi->dv_level, > > > > > > > > > > dovi->rpu_present_flag, > > > > > > > > > > dovi->el_present_flag, > > > > > > > > > > dovi->bl_present_flag, > > > > > > > > > > + dependency_pid, > > > > > > > > > > dovi->dv_bl_signal_compatibility_id); > > > > > > > > > > } > > > > > > > > > > break; > > > > > > > > > > -- > > > > > > > > > > 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". > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi, this is something I had fixed in this patchset: > > > > > > > > > > > https://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/286234.html > > > > > > > > > However the dependency_pid is ignored, as it has no use > > presently. > > > > > > > > > > > > > > > > >
[FFmpeg-devel] [PATCH v2] avutil/hwcontext_videotoolbox: fix use of unknown builtin '__builtin_available'
From: Limin Wang OSX version: 10.11.6 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Signed-off-by: Limin Wang --- configure | 8 ++ libavutil/hwcontext_videotoolbox.c | 54 +- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/configure b/configure index ede8f97..c4fb1b7 100755 --- a/configure +++ b/configure @@ -2329,6 +2329,10 @@ TYPES_LIST=" kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ kCVImageBufferTransferFunction_ITU_R_2100_HLG kCVImageBufferTransferFunction_Linear +kCVImageBufferYCbCrMatrix_ITU_R_2020 +kCVImageBufferColorPrimaries_ITU_R_2020 +kCVImageBufferTransferFunction_ITU_R_2020 +kCVImageBufferTransferFunction_SMPTE_ST_428_1 socklen_t struct_addrinfo struct_group_source_req @@ -6273,6 +6277,10 @@ enabled videotoolbox && { check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo" check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_Linear "-framework CoreVideo" +check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferYCbCrMatrix_ITU_R_2020 "-framework CoreVideo" +check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferColorPrimaries_ITU_R_2020 "-framework CoreVideo" +check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2020 "-framework CoreVideo" +check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_428_1 "-framework CoreVideo" } check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index 58095a1..25f4e17 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -375,10 +375,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->colorspace) { case AVCOL_SPC_BT2020_CL: case AVCOL_SPC_BT2020_NCL: -if (__builtin_available(macOS 10.11, *)) -colormatrix = kCVImageBufferYCbCrMatrix_ITU_R_2020; -else -colormatrix = CFSTR("ITU_R_2020"); +#if HAVE_KCVIMAGEBUFFERYCBCRMATRIX_ITU_R_2020 +colormatrix = kCVImageBufferYCbCrMatrix_ITU_R_2020; +#else +colormatrix = CFSTR("ITU_R_2020"); +#endif break; case AVCOL_SPC_BT470BG: case AVCOL_SPC_SMPTE170M: @@ -398,10 +399,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->color_primaries) { case AVCOL_PRI_BT2020: -if (__builtin_available(macOS 10.11, *)) -colorpri = kCVImageBufferColorPrimaries_ITU_R_2020; -else -colorpri = CFSTR("ITU_R_2020"); +#if HAVE_KCVIMAGEBUFFERCOLORPRIMARIES_ITU_R_2020 +colorpri = kCVImageBufferColorPrimaries_ITU_R_2020; +#else +colorpri = CFSTR("ITU_R_2020"); +#endif break; case AVCOL_PRI_BT709: colorpri = kCVImageBufferColorPrimaries_ITU_R_709_2; @@ -420,17 +422,19 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, switch (src->color_trc) { case AVCOL_TRC_SMPTE2084: -if (__builtin_available(macOS 10.13, *)) -colortrc = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ; -else -colortrc = CFSTR("SMPTE_ST_2084_PQ"); +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ +colortrc = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ; +#else +colortrc = CFSTR("SMPTE_ST_2084_PQ"); +#endif break; case AVCOL_TRC_BT2020_10: case AVCOL_TRC_BT2020_12: -if (__builtin_available(macOS 10.11, *)) -colortrc = kCVImageBufferTransferFunction_ITU_R_2020; -else -colortrc = CFSTR("ITU_R_2020"); +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2020 +colortrc = kCVImageBufferTransferFunction_ITU_R_2020; +#else +colortrc = CFSTR("ITU_R_2020"); +#endif break; case AVCOL_TRC_BT709: colortrc = kCVImageBufferTransferFunction_ITU_R_709_2; @@ -439,16 +443,18 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc, colortrc = kCVImageBufferTransferFunction_SMPTE_240M_1995; break; case AVCOL_TRC_SMPTE428: -if (__builtin_available(macOS 10.12, *)) -colortrc = kCVImageBufferTransferFunction_SMPTE_ST_428_1; -else -colortrc = CFSTR("SMPTE_ST_428_1"); +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_428_1 +colortrc = kCVImageBufferTransferFunction_SMPTE_ST_428_1; +#else +colortrc = CFSTR("SMPTE_ST_428_1"); +#endif break; case AVCOL_TRC_ARIB_STD_B67: -if (__builtin_available(macOS 10.13, *)) -colortrc = kCVImageBufferTransferFunction_ITU_R_2100_HLG; -else
Re: [FFmpeg-devel] [PATCH] Fix first_pcr initial update
On Tue, Nov 02, 2021 at 12:47:57PM +0200, Maksym Veremeyenko wrote: > One of latest commit > https://source.ffmpeg.org/?p=ffmpeg.git;a=commitdiff;h=6f36eb0da71d22aadf8f056f0966bd86656ea57e > claim it fixes endless loop on package generation if muxrate specified and > copyts used. But actually it does not work properly if *-mpegts_copyts 1* > specified: > > ffmpeg -y -copyts -i loewe.ts -c:v libx264 -x264opts nal-hrd=cbr:force-cfr=1 > -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 1000k -c:a mp2 -f mpegts > -mpegts_copyts 1 -muxrate 4500k -vframes 1000 test.ts > > ffmpeg generate huge file until it reach zero-based pcr value equal to first > dts. > > attached patch fix it. > > > -- > Maksym Veremeyenko > From fff0339c6d764e18fc4ecf111d035095309dc4d4 Mon Sep 17 00:00:00 2001 > From: Maksym Veremeyenko > Date: Tue, 2 Nov 2021 12:33:54 +0200 > Subject: [PATCH] Fix first_pcr initial update > > --- > libavformat/mpegtsenc.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c > index 35c835c..32786be 100644 > --- a/libavformat/mpegtsenc.c > +++ b/libavformat/mpegtsenc.c > @@ -1693,17 +1693,17 @@ static int > mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) > stream_id = side_data[0]; > > if (ts->copyts < 1) { > -if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) { > -ts->first_pcr += dts * 300; > -ts->first_dts_checked = 1; > -} > - > if (pts != AV_NOPTS_VALUE) > pts += delay; > if (dts != AV_NOPTS_VALUE) > dts += delay; > } > > +if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) { > +ts->first_pcr += dts * 300; > +ts->first_dts_checked = 1; > +} > + I think it's not same as the old code, the first_pcr will add extra delay if copyts is 0. > if (!ts_st->first_timestamp_checked && (pts == AV_NOPTS_VALUE || dts == > AV_NOPTS_VALUE)) { > av_log(s, AV_LOG_ERROR, "first pts and dts value must be set\n"); > return AVERROR_INVALIDDATA; > -- > 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". -- 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] Fix first_pcr initial update
On Tue, Nov 02, 2021 at 05:36:37PM +0200, Maksym Veremeyenko wrote: > On 02.11.2021 16:59, lance.lmw...@gmail.com wrote: > [...] > > > +if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) { > > > +ts->first_pcr += dts * 300; > > > +ts->first_dts_checked = 1; > > > +} > > > + > > > > I think it's not same as the old code, the first_pcr will add extra delay > > if copyts is > > 0. > > > > proposed patch extend updating ts->first_pcr not only when copyts is 0 but > when copyts is 1 (*-mpegts_copyts 1* specified) > > very similar issue i found at > http://ffmpeg.org/pipermail/ffmpeg-devel/2019-April/242766.html > I mean you need move the code before if (ts->copyts < 1) { instead of after. try with below command: ./ffmpeg -y -copyts -i http://samples.ffmpeg.org/MPEG2/foxksaz.ts -c:v libx264 -x264opts nal-hrd=cbr:force-cfr=1 \ -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 1000k -c:a mp2 -f mpegts \ -mpegts_copyts 0 -muxrate 4500k -vframes 1000 test.ts You'll get some "dts < pcr, TS is invalid" message. > -- > Maksym Veremeyenko > > ___ > 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] Fix first_pcr initial update
On Wed, Nov 03, 2021 at 01:01:29PM +0200, Maksym Veremeyenko wrote: > On 02.11.2021 12:47, Maksym Veremeyenko wrote: > > One of latest commit > > https://source.ffmpeg.org/?p=ffmpeg.git;a=commitdiff;h=6f36eb0da71d22aadf8f056f0966bd86656ea57e > > claim it fixes endless loop on package generation if muxrate specified > > and copyts used. But actually it does not work properly if > > *-mpegts_copyts 1* specified: > > > > ffmpeg -y -copyts -i loewe.ts -c:v libx264 -x264opts > > nal-hrd=cbr:force-cfr=1 -b:v 3500k -minrate 3500k -maxrate 3500k > > -bufsize 1000k -c:a mp2 -f mpegts -mpegts_copyts 1 -muxrate 4500k > > -vframes 1000 test.ts > > > > ffmpeg generate huge file until it reach zero-based pcr value equal to > > first dts. > > > > updated patch attached > > -- > Maksym Veremeyenko > From 5d6265e84417d7169d9c225be7305c116c33042f Mon Sep 17 00:00:00 2001 > From: Maksym Veremeyenko > Date: Wed, 3 Nov 2021 12:57:45 +0200 > Subject: [PATCH] Fix first_pcr initial update > > --- > libavformat/mpegtsenc.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c > index 35c835c..dd01628 100644 > --- a/libavformat/mpegtsenc.c > +++ b/libavformat/mpegtsenc.c > @@ -1692,12 +1692,12 @@ static int > mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) > if (side_data) > stream_id = side_data[0]; > > -if (ts->copyts < 1) { > -if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) { > -ts->first_pcr += dts * 300; > -ts->first_dts_checked = 1; > -} > +if (!ts->first_dts_checked && dts != AV_NOPTS_VALUE) { > +ts->first_pcr += dts * 300; > +ts->first_dts_checked = 1; > +} > > +if (ts->copyts < 1) { > if (pts != AV_NOPTS_VALUE) > pts += delay; > if (dts != AV_NOPTS_VALUE) > -- > 1.8.3.1 > 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". -- 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] [PATCH 1/2] avfilter/af_atilt: use ff_filter_execute()
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/af_atilt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_atilt.c b/libavfilter/af_atilt.c index a1ce030..a6f7782 100644 --- a/libavfilter/af_atilt.c +++ b/libavfilter/af_atilt.c @@ -196,7 +196,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; -ctx->internal->execute(ctx, s->filter_channels, &td, NULL, FFMIN(inlink->channels, +ff_filter_execute(ctx, s->filter_channels, &td, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (out != in) -- 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/2] avutil/slicethread: Add a maximum constraint of 16 slice threads
From: Limin Wang Signed-off-by: Limin Wang --- libavutil/slicethread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c index 867ce32..7b3a106 100644 --- a/libavutil/slicethread.c +++ b/libavutil/slicethread.c @@ -104,7 +104,7 @@ int avpriv_slicethread_create(AVSliceThread **pctx, void *priv, if (!nb_threads) { int nb_cpus = av_cpu_count(); if (nb_cpus > 1) -nb_threads = nb_cpus + 1; +nb_threads = FFMIN(nb_cpus + 1, 16); else nb_threads = 1; } -- 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 2/2] avutil/slicethread: Add a maximum constraint of 16 slice threads
On Fri, Nov 05, 2021 at 10:00:41PM +0100, Michael Niedermayer wrote: > On Fri, Nov 05, 2021 at 08:32:16PM +0800, lance.lmw...@gmail.com wrote: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavutil/slicethread.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c > > index 867ce32..7b3a106 100644 > > --- a/libavutil/slicethread.c > > +++ b/libavutil/slicethread.c > > @@ -104,7 +104,7 @@ int avpriv_slicethread_create(AVSliceThread **pctx, > > void *priv, > > if (!nb_threads) { > > int nb_cpus = av_cpu_count(); > > if (nb_cpus > 1) > > -nb_threads = nb_cpus + 1; > > +nb_threads = FFMIN(nb_cpus + 1, 16); > > why should the threads be limited ? > why should they be limited at 16 for everyone ? > one mighht be a 2 core cpu one might have 200 cores When using movie filter, it use ff_filter_get_nb_threads(ctx), but we can't force the thread number by option, so it's auto thread mode. When testing one a 4 core cpu(about 200 cores), the auto thread mode will use all cores for video decode, it'll drop the performance very much. If most of user prefer to use all cores, I'll try to limit the number in movie filter only. For a 4 socket numa system, I don't think it's preferable configure to use all cpu cores if it's auto thread(nb_threads = 0). > > i think the commit message should be more verbose describing what the > problem is that this is fixing > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Homeopathy is like voting while filling the ballot out with transparent ink. > Sometimes the outcome one wanted occurs. Rarely its worse than filling out > a ballot properly. > ___ > 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] [PATCH v2] avfilter/src_movie: Add a maximum constraint of 16 slice threads
From: Limin Wang It's configured the number of video decode thread, so use the same maximum constraint as MAX_AUTO_THREADS in libavcodec/pthread_internal.h Signed-off-by: Limin Wang --- libavfilter/src_movie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 573f363..cd431b1 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -169,7 +169,7 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st) if (ret < 0) return ret; -st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx); +st->codec_ctx->thread_count = FFMIN(ff_filter_get_nb_threads(ctx), 16); if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); -- 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 2/2] avutil/slicethread: Add a maximum constraint of 16 slice threads
On Sat, Nov 06, 2021 at 08:42:38AM +0100, Hendrik Leppkes wrote: > On Sat, Nov 6, 2021 at 6:26 AM wrote: > > > > On Fri, Nov 05, 2021 at 10:00:41PM +0100, Michael Niedermayer wrote: > > > On Fri, Nov 05, 2021 at 08:32:16PM +0800, lance.lmw...@gmail.com wrote: > > > > From: Limin Wang > > > > > > > > Signed-off-by: Limin Wang > > > > --- > > > > libavutil/slicethread.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c > > > > index 867ce32..7b3a106 100644 > > > > --- a/libavutil/slicethread.c > > > > +++ b/libavutil/slicethread.c > > > > @@ -104,7 +104,7 @@ int avpriv_slicethread_create(AVSliceThread **pctx, > > > > void *priv, > > > > if (!nb_threads) { > > > > int nb_cpus = av_cpu_count(); > > > > if (nb_cpus > 1) > > > > -nb_threads = nb_cpus + 1; > > > > +nb_threads = FFMIN(nb_cpus + 1, 16); > > > > > > why should the threads be limited ? > > > why should they be limited at 16 for everyone ? > > > one mighht be a 2 core cpu one might have 200 cores > > > > When using movie filter, it use ff_filter_get_nb_threads(ctx), but we can't > > force the thread > > number by option, so it's auto thread mode. When testing one a 4 core > > cpu(about 200 cores), > > the auto thread mode will use all cores for video decode, it'll drop the > > performance very much. > > If most of user prefer to use all cores, I'll try to limit the number in > > movie filter only. > > > > For a 4 socket numa system, I don't think it's preferable configure to use > > all cpu cores > > if it's auto thread(nb_threads = 0). > > > > > > The answer to that issue should be to make it configurable, and not > just introduce a hard limit in a utility function in avutil. OK, I'll add a thread option for src_movie filter to make the decode thread configurable. > > - Hendrik > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". -- 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 v2] avfilter/src_movie: Add a maximum constraint of 16 slice threads
On Sat, Nov 06, 2021 at 11:44:08AM +0100, Paul B Mahol wrote: > NACK What's your suggestion? any objection if add a thread option for src_movie filter? -- 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] [PATCH v3] avfilter/src_movie: make the number of decode thread configurable
From: Limin Wang Please use threads option if you want the number of thread configurable. Signed-off-by: Limin Wang --- libavfilter/src_movie.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 573f363..5811675 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -169,7 +169,9 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st) if (ret < 0) return ret; -st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx); +if (!ctx->nb_threads) +ctx->nb_threads = ff_filter_get_nb_threads(ctx); +st->codec_ctx->thread_count = ctx->nb_threads; if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); -- 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 v3] avfilter/src_movie: make the number of decode thread configurable
On Sat, Nov 06, 2021 at 02:59:06PM +0100, Paul B Mahol wrote: > On Sat, Nov 6, 2021 at 2:48 PM wrote: > > > From: Limin Wang > > > > Please use threads option if you want the number of thread configurable. > > > > > Generally bad idea to use number of filtering threads for decoding threads. I agree. I'll update the patch to add a new option "dec_threads" for the decoding threads. > > > > Signed-off-by: Limin Wang > > --- > > libavfilter/src_movie.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c > > index 573f363..5811675 100644 > > --- a/libavfilter/src_movie.c > > +++ b/libavfilter/src_movie.c > > @@ -169,7 +169,9 @@ static int open_stream(AVFilterContext *ctx, > > MovieStream *st) > > if (ret < 0) > > return ret; > > > > -st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx); > > +if (!ctx->nb_threads) > > +ctx->nb_threads = ff_filter_get_nb_threads(ctx); > > +st->codec_ctx->thread_count = ctx->nb_threads; > > > > if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) { > > av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); > > -- > > 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". > > -- 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] [PATCH v4] avfilter/src_movie: make the number of decode thread configurable
From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi| 3 +++ libavfilter/src_movie.c | 10 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index b537e42..c9ef854 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -28344,6 +28344,9 @@ changed, so it will generate non monotonically increasing timestamps. Specifies the time difference between frames above which the point is considered a timestamp discontinuity which is removed by adjusting the later timestamps. + +@item dec_threads +Specifies the number of threads for decoding @end table It allows overlaying a second video on top of the main input of diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 573f363..5a4e77b 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -67,6 +67,7 @@ typedef struct MovieContext { int loop_count; int64_t discontinuity_threshold; int64_t ts_offset; +int dec_threads; AVFormatContext *format_ctx; @@ -90,6 +91,7 @@ static const AVOption movie_options[]= { { "s","set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, 0, 0, FLAGS }, { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT,{.i64 = 1}, 0,INT_MAX, FLAGS }, { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS }, +{ "dec_threads", "set the number of threads for decoding", OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS }, { NULL }, }; @@ -150,7 +152,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) return found; } -static int open_stream(AVFilterContext *ctx, MovieStream *st) +static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads) { const AVCodec *codec; int ret; @@ -169,7 +171,9 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st) if (ret < 0) return ret; -st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx); +if (!dec_threads) +dec_threads = ff_filter_get_nb_threads(ctx); +st->codec_ctx->thread_count = dec_threads; if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); @@ -314,7 +318,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx) if (ret < 0) return ret; } -ret = open_stream(ctx, &movie->st[i]); +ret = open_stream(ctx, &movie->st[i], movie->dec_threads); if (ret < 0) return ret; } -- 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 01/11] avformat/rtpdec_rfc4175: use rawvideo for uyvy422
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index f50cad7..f13736b 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -55,9 +55,11 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) if (data->depth == 8) { data->pgroup = 4; pixfmt = AV_PIX_FMT_UYVY422; +stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; } else if (data->depth == 10) { data->pgroup = 5; pixfmt = AV_PIX_FMT_YUV422P10; +stream->codecpar->codec_id = AV_CODEC_ID_BITPACKED; } else { return AVERROR_INVALIDDATA; } @@ -268,7 +270,7 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, const RTPDynamicProtocolHandler ff_rfc4175_rtp_handler = { .enc_name = "raw", .codec_type = AVMEDIA_TYPE_VIDEO, -.codec_id = AV_CODEC_ID_BITPACKED, +.codec_id = AV_CODEC_ID_NONE, .priv_data_size = sizeof(PayloadContext), .parse_sdp_a_line = rfc4175_parse_sdp_line, .parse_packet = rfc4175_handle_packet, -- 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 02/11] avcodec/bitpacked: remove unneeded 8bit support
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/bitpacked.c | 44 +--- 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/libavcodec/bitpacked.c b/libavcodec/bitpacked.c index 0440df9..d239141 100644 --- a/libavcodec/bitpacked.c +++ b/libavcodec/bitpacked.c @@ -36,29 +36,6 @@ struct BitpackedContext { const AVPacket *pkt); }; -/* For this format, it's a simple passthrough */ -static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame, -const AVPacket *avpkt) -{ -int ret; - -/* there is no need to copy as the data already match - * a known pixel format */ -frame->buf[0] = av_buffer_ref(avpkt->buf); -if (!frame->buf[0]) { -return AVERROR(ENOMEM); -} - -ret = av_image_fill_arrays(frame->data, frame->linesize, avpkt->data, - avctx->pix_fmt, avctx->width, avctx->height, 1); -if (ret < 0) { -av_buffer_unref(&frame->buf[0]); -return ret; -} - -return 0; -} - static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, const AVPacket *avpkt) { @@ -102,21 +79,14 @@ static av_cold int bitpacked_init_decoder(AVCodecContext *avctx) { struct BitpackedContext *bc = avctx->priv_data; -if (!avctx->codec_tag || !avctx->width || !avctx->height) +if (!avctx->width || !avctx->height) return AVERROR_INVALIDDATA; -if (avctx->codec_tag == MKTAG('U', 'Y', 'V', 'Y')) { -if (avctx->bits_per_coded_sample == 16 && -avctx->pix_fmt == AV_PIX_FMT_UYVY422) -bc->decode = bitpacked_decode_uyvy422; -else if (avctx->bits_per_coded_sample == 20 && - avctx->pix_fmt == AV_PIX_FMT_YUV422P10) -bc->decode = bitpacked_decode_yuv422p10; -else -return AVERROR_INVALIDDATA; -} else { +if (avctx->bits_per_coded_sample == 20 && +avctx->pix_fmt == AV_PIX_FMT_YUV422P10) +bc->decode = bitpacked_decode_yuv422p10; +else return AVERROR_INVALIDDATA; -} return 0; } @@ -150,9 +120,5 @@ const AVCodec ff_bitpacked_decoder = { .init = bitpacked_init_decoder, .decode = bitpacked_decode, .capabilities = AV_CODEC_CAP_EXPERIMENTAL, -.codec_tags = (const uint32_t []){ -MKTAG('U', 'Y', 'V', 'Y'), -FF_CODEC_TAGS_END, -}, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; -- 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 03/11] avformat/rtpdec_rfc4175: remove the unused tag
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index f13736b..fe0754f 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -45,11 +45,9 @@ struct PayloadContext { static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) { enum AVPixelFormat pixfmt; -int tag; const AVPixFmtDescriptor *desc; if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { -tag = MKTAG('U', 'Y', 'V', 'Y'); data->xinc = 2; if (data->depth == 8) { @@ -69,7 +67,6 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) desc = av_pix_fmt_desc_get(pixfmt); stream->codecpar->format = pixfmt; -stream->codecpar->codec_tag = tag; stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); data->frame_size = data->width * data->height * data->pgroup / data->xinc; -- 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 04/11] avformat/rtpdec_rfc4175: support for yuv420p format
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index fe0754f..81930ce 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -61,6 +61,17 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) } else { return AVERROR_INVALIDDATA; } +} else if (!strncmp(data->sampling, "YCbCr-4:2:0", 11)) { +data->xinc = 4; + +if (data->depth == 8) { +data->pgroup = 6; +pixfmt = AV_PIX_FMT_YUV420P; +stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; +} else { +return AVERROR_INVALIDDATA; +} + } else { return AVERROR_INVALIDDATA; } -- 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 05/11] avformat/rtpenc: adds partial support for the RFC 4175
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/Makefile | 1 + libavformat/rtpenc.c | 4 ++ libavformat/rtpenc.h | 1 + libavformat/rtpenc_rfc4175.c | 116 +++ libavformat/sdp.c| 25 ++ 5 files changed, 147 insertions(+) create mode 100644 libavformat/rtpenc_rfc4175.c diff --git a/libavformat/Makefile b/libavformat/Makefile index 3d6c8ef..a19d2e0 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -482,6 +482,7 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o \ rtpenc_jpeg.o \ rtpenc_mpv.o \ rtpenc.o \ +rtpenc_rfc4175.o\ rtpenc_vc2hq.o \ rtpenc_vp8.o \ rtpenc_vp9.o\ diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 2a1c176..4f115cc 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -84,6 +84,7 @@ static int is_supported(enum AVCodecID id) case AV_CODEC_ID_MJPEG: case AV_CODEC_ID_SPEEX: case AV_CODEC_ID_OPUS: +case AV_CODEC_ID_RAWVIDEO: return 1; default: return 0; @@ -619,6 +620,9 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) case AV_CODEC_ID_MJPEG: ff_rtp_send_jpeg(s1, pkt->data, size); break; +case AV_CODEC_ID_RAWVIDEO: +ff_rtp_send_raw_rfc4175 (s1, pkt->data, size); +break; case AV_CODEC_ID_OPUS: if (size > s->max_payload_size) { av_log(s1, AV_LOG_ERROR, diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h index 62dc9ab..70ea85b 100644 --- a/libavformat/rtpenc.h +++ b/libavformat/rtpenc.h @@ -95,6 +95,7 @@ void ff_rtp_send_vc2hq(AVFormatContext *s1, const uint8_t *buf, int size, int in void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size); void ff_rtp_send_vp9(AVFormatContext *s1, const uint8_t *buff, int size); void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buff, int size); +void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size); const uint8_t *ff_h263_find_resync_marker_reverse(const uint8_t *av_restrict start, const uint8_t *av_restrict end); diff --git a/libavformat/rtpenc_rfc4175.c b/libavformat/rtpenc_rfc4175.c new file mode 100644 index 000..b6f833b --- /dev/null +++ b/libavformat/rtpenc_rfc4175.c @@ -0,0 +1,116 @@ +/* + * RTP Packetization of RAW video (RFC4175) + * Copyright (c) 2021 Limin Wang + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "avformat.h" +#include "rtpenc.h" + +void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size) +{ +RTPMuxContext *s = s1->priv_data; +int width = s1->streams[0]->codecpar->width; +int height = s1->streams[0]->codecpar->height; +int xinc, yinc, pgroup; +int field = 0; +int i = 0; +int offset = 0; + +s->timestamp = s->cur_timestamp; +switch (s1->streams[0]->codecpar->format) { +case AV_PIX_FMT_UYVY422: +xinc = yinc = 2; +pgroup = 4; +break; +case AV_PIX_FMT_YUV420P: +xinc = yinc = 4; +pgroup = 6; +break; +default: +return; +} + +while (i < height) { +int left = s->max_payload_size; +uint8_t *dest = s->buf; +uint8_t *headers; +const int head_size = 6; +int next_line; +int length, cont, pixels; + +/* Extended Sequence Number */ +*dest++ = 0; +*dest++ = 0; +left -= 2; + +headers = dest; +do { +pixels = width * xinc - offset; +length = (pixels * pgroup) / xinc; + +left -= head_size; +if (left >= length) { +next_line = 1; +} else { +pixels = (left / pgroup) * xinc; +length = (pixels * pgroup) / xinc; +
[FFmpeg-devel] [PATCH 06/11] avcodec: use s210 fourcc for 10-bit 4:2:2 packed
From: Limin Wang s210 is used by AWS Elemental Live encoder so I prefer to use same to support 4:2:2 10-bit packed uncompressed video. Refer to: https://docs.aws.amazon.com/elemental-live/latest/ug/codec-vod-outputs.html I split the patch for better review, next patch will rename bitpacked.c to s210dec.c to reflect the change. Signed-off-by: Limin Wang --- libavcodec/Makefile | 2 +- libavcodec/allcodecs.c | 2 +- libavcodec/bitpacked.c | 33 + libavcodec/codec_desc.c | 6 +++--- libavcodec/codec_id.h| 2 +- libavformat/rtpdec_rfc4175.c | 2 +- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 14fbd2e..8ae28e8 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -243,7 +243,7 @@ OBJS-$(CONFIG_BINK_DECODER)+= bink.o binkdsp.o OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER) += binkaudio.o OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER) += binkaudio.o OBJS-$(CONFIG_BINTEXT_DECODER) += bintext.o cga_data.o -OBJS-$(CONFIG_BITPACKED_DECODER) += bitpacked.o +OBJS-$(CONFIG_S210_DECODER)+= bitpacked.o OBJS-$(CONFIG_BMP_DECODER) += bmp.o msrledec.o OBJS-$(CONFIG_BMP_ENCODER) += bmpenc.o OBJS-$(CONFIG_BMV_AUDIO_DECODER) += bmvaudio.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 9ede09b..c461798 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -64,7 +64,7 @@ extern const AVCodec ff_ayuv_decoder; extern const AVCodec ff_bethsoftvid_decoder; extern const AVCodec ff_bfi_decoder; extern const AVCodec ff_bink_decoder; -extern const AVCodec ff_bitpacked_decoder; +extern const AVCodec ff_s210_decoder; extern const AVCodec ff_bmp_encoder; extern const AVCodec ff_bmp_decoder; extern const AVCodec ff_bmv_video_decoder; diff --git a/libavcodec/bitpacked.c b/libavcodec/bitpacked.c index d239141..7bc5dbc 100644 --- a/libavcodec/bitpacked.c +++ b/libavcodec/bitpacked.c @@ -1,6 +1,7 @@ /* - * Unpack bit-packed streams to formats supported by FFmpeg + * S210 decoder * Copyright (c) 2017 Savoir-faire Linux, Inc + * Copyright (c) 2021 Limin Wang * * This file is part of FFmpeg. * @@ -23,7 +24,7 @@ /** * @file - * Bitpacked + * s210dec */ #include "avcodec.h" @@ -31,12 +32,12 @@ #include "get_bits.h" #include "libavutil/imgutils.h" -struct BitpackedContext { +struct S210Context { int (*decode)(AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt); }; -static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, +static int s210_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, const AVPacket *avpkt) { uint64_t frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20; @@ -75,26 +76,26 @@ static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, return 0; } -static av_cold int bitpacked_init_decoder(AVCodecContext *avctx) +static av_cold int s210_init_decoder(AVCodecContext *avctx) { -struct BitpackedContext *bc = avctx->priv_data; +struct S210Context *bc = avctx->priv_data; if (!avctx->width || !avctx->height) return AVERROR_INVALIDDATA; if (avctx->bits_per_coded_sample == 20 && avctx->pix_fmt == AV_PIX_FMT_YUV422P10) -bc->decode = bitpacked_decode_yuv422p10; +bc->decode = s210_decode_yuv422p10; else return AVERROR_INVALIDDATA; return 0; } -static int bitpacked_decode(AVCodecContext *avctx, void *data, int *got_frame, +static int s210_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { -struct BitpackedContext *bc = avctx->priv_data; +struct S210Context *bc = avctx->priv_data; int buf_size = avpkt->size; AVFrame *frame = data; int res; @@ -111,14 +112,14 @@ static int bitpacked_decode(AVCodecContext *avctx, void *data, int *got_frame, } -const AVCodec ff_bitpacked_decoder = { -.name = "bitpacked", -.long_name = NULL_IF_CONFIG_SMALL("Bitpacked"), +const AVCodec ff_s210_decoder = { +.name = "s210", +.long_name = NULL_IF_CONFIG_SMALL("10-bit 4:2:2 packed"), .type = AVMEDIA_TYPE_VIDEO, -.id = AV_CODEC_ID_BITPACKED, -.priv_data_size= sizeof(struct BitpackedContext), -.init = bitpacked_init_decoder, -.decode = bitpacked_decode, +.id = AV_CODEC_ID_S210, +.priv_data_size= sizeof(struct S210Context), +.init = s210_init_decoder, +.decode = s210_decode, .capabilities = AV_CODEC_CAP_EXPERIMENTAL, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 0974ee0..d1cc4d0 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1645,10 +1645,10 @@ static const AVCodecDescriptor codec_descriptors[] = { .profiles = NUL