Re: [FFmpeg-devel] [PATCH 7/7] avformat: add Changelog entry for librist and bump minor
On Sun, 7 Mar 2021, Paul B Mahol wrote: On Sun, Mar 7, 2021 at 1:57 AM James Almer wrote: On 3/6/2021 9:51 PM, Paul B Mahol wrote: > On Sun, Mar 7, 2021 at 1:35 AM Marton Balint wrote: > >> >> >> On Sun, 7 Mar 2021, Paul B Mahol wrote: >> >>> How you tested this? >> >> with the librist tools. >> >>> >>> And why you have not asked nicely before taking working on this? >> >> You wrote you have given up. It is your behaviour which is not very nice. >> After your continuous ignorance of my requests, I try to help your work >> get merged, and this is your feedback... >> > > > Why are you so aggressive? Other devs raised issues that looks not resolved. I don't see aggressiveness from his part. I see you making things incredibly more complex than they should be. The code in functional part is not much different from initial versions. So I really doubt that fifo filling up issue have been properly addressed. I can take a look at that if you provide command lines to reproduce. Regards, Marton ___ 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/5] avfilter/avfilter: Remove avfilter_link_set_closed() on bump
Andreas Rheinhardt (12021-03-07): > Deprecated in 39a09e995d32d16e4f8c87a6ff5273cb9d98146e. > > Signed-off-by: Andreas Rheinhardt > --- > libavfilter/avfilter.c | 3 ++- > libavfilter/avfilter.h | 4 ++-- > libavfilter/version.h | 3 +++ > 3 files changed, 7 insertions(+), 3 deletions(-) Ok. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/5] avfilter/buffersink: Postpone removal of av_[a]buffersink_params_alloc
Andreas Rheinhardt (12021-03-07): > They have been deprecated in 61097535cdaa91fea0d62c567b3af02a940f6c2d, > yet this was less than two years ago. Removing them will therefore have > to wait. > > Signed-off-by: Andreas Rheinhardt > --- > libavfilter/buffersink.c | 2 +- > libavfilter/buffersink.h | 2 +- > libavfilter/version.h| 3 +++ > 3 files changed, 5 insertions(+), 2 deletions(-) Ok. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 7/7] avformat: add Changelog entry for librist and bump minor
On Sun, Mar 7, 2021 at 9:02 AM Marton Balint wrote: > > > On Sun, 7 Mar 2021, Paul B Mahol wrote: > > > On Sun, Mar 7, 2021 at 1:57 AM James Almer wrote: > > > >> On 3/6/2021 9:51 PM, Paul B Mahol wrote: > >> > On Sun, Mar 7, 2021 at 1:35 AM Marton Balint wrote: > >> > > >> >> > >> >> > >> >> On Sun, 7 Mar 2021, Paul B Mahol wrote: > >> >> > >> >>> How you tested this? > >> >> > >> >> with the librist tools. > >> >> > >> >>> > >> >>> And why you have not asked nicely before taking working on this? > >> >> > >> >> You wrote you have given up. It is your behaviour which is not very > >> nice. > >> >> After your continuous ignorance of my requests, I try to help your > work > >> >> get merged, and this is your feedback... > >> >> > >> > > >> > > >> > Why are you so aggressive? Other devs raised issues that looks not > >> resolved. > >> > >> I don't see aggressiveness from his part. I see you making things > >> incredibly more complex than they should be. > >> > > > > The code in functional part is not much different from initial versions. > > > > So I really doubt that fifo filling up issue have been properly > addressed. > > I can take a look at that if you provide command lines to reproduce. > I couldn't reproduce it, so you have to ask others. > > Regards, > Marton > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/codec: add doxy to AVCodec.decode()
James Almer: > Signed-off-by: James Almer > --- > libavcodec/codec.h | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/libavcodec/codec.h b/libavcodec/codec.h > index bcda061da1..c019e7357c 100644 > --- a/libavcodec/codec.h > +++ b/libavcodec/codec.h > @@ -281,6 +281,17 @@ typedef struct AVCodec { > */ > int (*encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt, > const struct AVFrame *frame, int *got_packet_ptr); > +/** > + * Decode picture or subtitle data. > + * > + * @param avctx codec context For this to make sense you need to add the variable name in patch 2. > + * @param outdatacodec type dependent output struct Why didn't you set the "[out]"? > + * @param[out] got_packet_ptr decoder sets to 0 or 1 to indicate that a Should be got_frame_ptr. (I am unsure whether we should retain that "_ptr". It seems superfluous.) > + *non-empty frame or subtitle was returned in > + *outdata. > + * @param[in] avpkt AVPacket containing the bitstream to be > decoded Maybe use data instead of bitstream. After all, it may also contain side-data and other information. > + * @return amount of bytes read from the packet, negative error code on > failure > + */ > int (*decode)(struct AVCodecContext *, void *outdata, int *got_frame_ptr, >struct AVPacket *avpkt); > int (*close)(struct AVCodecContext *); > ___ 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/3] avcodec/codec: use the correct name for all AVCodec.decode() parameters
James Almer: > This field hasn't been used to return the output frame size since > avcodec_decode_audio3() was removed. If I read 0eea212943544d40f99b05571aa7159d78667154 correctly, then the semantics changed with the addition of avcodec_decode_audio4() and not the removal of avcodec_decode_audio3(); (but there seemed to be some leftovers after that commit). > > Signed-off-by: James Almer > --- > libavcodec/codec.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/codec.h b/libavcodec/codec.h > index 3d7a1f4c26..bcda061da1 100644 > --- a/libavcodec/codec.h > +++ b/libavcodec/codec.h > @@ -281,7 +281,8 @@ typedef struct AVCodec { > */ > int (*encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt, > const struct AVFrame *frame, int *got_packet_ptr); > -int (*decode)(struct AVCodecContext *, void *outdata, int *outdata_size, > struct AVPacket *avpkt); > +int (*decode)(struct AVCodecContext *, void *outdata, int *got_frame_ptr, > + struct AVPacket *avpkt); I initially wanted to ask you to split the line after outdata to make this more balanced, but given that you need to add avctx anyway you have to do it anyway. > int (*close)(struct AVCodecContext *); > /** > * Encode API with decoupled frame/packet dataflow. This function is > called > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/codec: add doxy to AVCodec.decode()
On 3/7/2021 10:34 AM, Andreas Rheinhardt wrote: James Almer: Signed-off-by: James Almer --- libavcodec/codec.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavcodec/codec.h b/libavcodec/codec.h index bcda061da1..c019e7357c 100644 --- a/libavcodec/codec.h +++ b/libavcodec/codec.h @@ -281,6 +281,17 @@ typedef struct AVCodec { */ int (*encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr); +/** + * Decode picture or subtitle data. + * + * @param avctx codec context For this to make sense you need to add the variable name in patch 2. Good catch. Will do that. + * @param outdatacodec type dependent output struct Why didn't you set the "[out]"? Because i copied it from the encode2() doxy. + * @param[out] got_packet_ptr decoder sets to 0 or 1 to indicate that a Should be got_frame_ptr. (I am unsure whether we should retain that "_ptr". It seems superfluous.) Fixed. + *non-empty frame or subtitle was returned in + *outdata. + * @param[in] avpkt AVPacket containing the bitstream to be decoded Maybe use data instead of bitstream. After all, it may also contain side-data and other information. Ok. + * @return amount of bytes read from the packet, negative error code on failure + */ int (*decode)(struct AVCodecContext *, void *outdata, int *got_frame_ptr, struct AVPacket *avpkt); int (*close)(struct AVCodecContext *); ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/codec: use the correct name for all AVCodec.decode() parameters
On 3/7/2021 10:43 AM, Andreas Rheinhardt wrote: James Almer: This field hasn't been used to return the output frame size since avcodec_decode_audio3() was removed. If I read 0eea212943544d40f99b05571aa7159d78667154 correctly, then the semantics changed with the addition of avcodec_decode_audio4() and not the removal of avcodec_decode_audio3(); (but there seemed to be some leftovers after that commit). You're right. Fixed. Signed-off-by: James Almer --- libavcodec/codec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/codec.h b/libavcodec/codec.h index 3d7a1f4c26..bcda061da1 100644 --- a/libavcodec/codec.h +++ b/libavcodec/codec.h @@ -281,7 +281,8 @@ typedef struct AVCodec { */ int (*encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr); -int (*decode)(struct AVCodecContext *, void *outdata, int *outdata_size, struct AVPacket *avpkt); +int (*decode)(struct AVCodecContext *, void *outdata, int *got_frame_ptr, + struct AVPacket *avpkt); I initially wanted to ask you to split the line after outdata to make this more balanced, but given that you need to add avctx anyway you have to do it anyway. Will do and push. Thanks. int (*close)(struct AVCodecContext *); /** * Encode API with decoupled frame/packet dataflow. This function is called ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 7/7] avformat: add Changelog entry for librist and bump minor
On Sun, 7 Mar 2021, Paul B Mahol wrote: On Sun, Mar 7, 2021 at 9:02 AM Marton Balint wrote: On Sun, 7 Mar 2021, Paul B Mahol wrote: > On Sun, Mar 7, 2021 at 1:57 AM James Almer wrote: > >> On 3/6/2021 9:51 PM, Paul B Mahol wrote: >> > On Sun, Mar 7, 2021 at 1:35 AM Marton Balint wrote: >> > >> >> >> >> >> >> On Sun, 7 Mar 2021, Paul B Mahol wrote: >> >> >> >>> How you tested this? >> >> >> >> with the librist tools. >> >> >> >>> >> >>> And why you have not asked nicely before taking working on this? >> >> >> >> You wrote you have given up. It is your behaviour which is not very >> nice. >> >> After your continuous ignorance of my requests, I try to help your work >> >> get merged, and this is your feedback... >> >> >> > >> > >> > Why are you so aggressive? Other devs raised issues that looks not >> resolved. >> >> I don't see aggressiveness from his part. I see you making things >> incredibly more complex than they should be. >> > > The code in functional part is not much different from initial versions. > > So I really doubt that fifo filling up issue have been properly addressed. I can take a look at that if you provide command lines to reproduce. I couldn't reproduce it, so you have to ask others. I found one issue in librist code which can be related and might cause ffmpeg not to recover from a fifo fillup. I have reported it here: https://code.videolan.org/rist/librist/-/issues/93 Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/mpeg4videodec: add forgotten flags to mpeg4_options
On Thu, Mar 04, 2021 at 07:06:45PM +0100, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavcodec/mpeg4videodec.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c > index fd985f0430..2ca804fdc6 100644 > --- a/libavcodec/mpeg4videodec.c > +++ b/libavcodec/mpeg4videodec.c > @@ -3551,9 +3551,11 @@ static av_cold int decode_init(AVCodecContext *avctx) > return 0; > } > > +#define OFFSET(x) offsetof(MpegEncContext, x) > +#define FLAGS AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY > static const AVOption mpeg4_options[] = { > -{"quarter_sample", "1/4 subpel MC", offsetof(MpegEncContext, > quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0}, > -{"divx_packed", "divx style packed b frames", offsetof(MpegEncContext, > divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0}, > +{"quarter_sample", "1/4 subpel MC", OFFSET(quarter_sample), > AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS}, > +{"divx_packed", "divx style packed b frames", OFFSET(divx_packed), > AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS}, > {NULL} > }; LGTM Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/ffplay: do not write out of rdft visualization texture
On Wed, Mar 03, 2021 at 11:27:22PM +0100, Marton Balint wrote: > If the window is resized it was possible that xpos pointed outside the > visualization texture. By rearranging the overflow check we make sure this > (and > a crash) does not happen. > > We also don't have to use xleft for start position, as that is 0 anyways, and > if we ever want to take into account xleft then the texture should be > positioned accordingly when rendering. reading this, i wonder if a assertion with xleft == 0 would make sense thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/httpauth: don't overwrite auth digest with unimplemented algorithm
From: Andriy Gelman In rtsp/http authentication the server may provide several options for hash algorithms. This includes MD5, SHA2-256 and SHA2-512/256 (RFC 7616 Section 3.7). Currently only support for MD5 is implemented in the auth code. If the SHA2 option follows the MD5 option in the server reply, the latter option will overwrite the MD5 auth info and the authorization will fail. This patch only overwrites the auth info if it's MD5. Fixes ticket #9127. Signed-off-by: Andriy Gelman --- An alternative may be to add the SHA2 code to http auth. I can work on this if people think it's a better option. Also, I could only test that the MD5 option doesn't get overwritten by modifying server responses in gdb. I could not find an rtsp server that has the SHA2 option as in #9127. libavformat/httpauth.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c index 4f79c78edc..0e57c5c3e5 100644 --- a/libavformat/httpauth.c +++ b/libavformat/httpauth.c @@ -101,12 +101,21 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key, state); } else if (av_stristart(value, "Digest ", &p) && state->auth_type <= HTTP_AUTH_DIGEST) { +HTTPAuthState state_copy; +const char* algorithm; +memcpy(&state_copy, state, sizeof(state_copy)); + state->auth_type = HTTP_AUTH_DIGEST; memset(&state->digest_params, 0, sizeof(DigestParams)); state->realm[0] = 0; state->stale = 0; ff_parse_key_value(p, (ff_parse_key_val_cb) handle_digest_params, state); +algorithm = state->digest_params.algorithm; +if (strcmp(algorithm, "") && strcmp(algorithm, "MD5") && strcmp(algorithm, "MD5-sess")) { +memcpy(state, &state_copy, sizeof(state_copy)); +return; +} choose_qop(state->digest_params.qop, sizeof(state->digest_params.qop)); if (!av_strcasecmp(state->digest_params.stale, "true")) -- 2.30.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/8] avcodec/jpeglsenc: Don't use put bits API for byte-aligned writes
Andreas Rheinhardt: > Signed-off-by: Andreas Rheinhardt > --- > Is it actually guaranteed that the allocated packet size is > sufficient? If it is, one could use unchecked writes throughout; if it > isn't, should I add a check to properly error out in case the buffer is > too small? (And what would the return value be in this case?) > > libavcodec/jpeglsenc.c | 80 +--- > libavcodec/mjpegenc.h| 6 --- > libavcodec/mjpegenc_common.c | 6 +++ > 3 files changed, 52 insertions(+), 40 deletions(-) > > diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c > index 5ecd430db7..feea6fdde7 100644 > --- a/libavcodec/jpeglsenc.c > +++ b/libavcodec/jpeglsenc.c > @@ -26,6 +26,7 @@ > */ > > #include "avcodec.h" > +#include "bytestream.h" > #include "get_bits.h" > #include "put_bits.h" > #include "golomb.h" > @@ -41,6 +42,18 @@ typedef struct JPEGLSContext { > int pred; > } JPEGLSContext; > > +static inline void put_markeru(PutByteContext *pb, enum JpegMarker code) > +{ > +bytestream2_put_byteu(pb, 0xff); > +bytestream2_put_byteu(pb, code); > +} > + > +static inline void put_marker(PutByteContext *pb, enum JpegMarker code) > +{ > +bytestream2_put_byte(pb, 0xff); > +bytestream2_put_byte(pb, code); > +} > + > /** > * Encode error from regular symbol > */ > @@ -230,7 +243,7 @@ static inline void ls_encode_line(JLSState *state, > PutBitContext *pb, > } > } > > -static void ls_store_lse(JLSState *state, PutBitContext *pb) > +static void ls_store_lse(JLSState *state, PutByteContext *pb) > { > /* Test if we have default params and don't need to store LSE */ > JLSState state2 = { 0 }; > @@ -243,14 +256,14 @@ static void ls_store_lse(JLSState *state, PutBitContext > *pb) > state->reset == state2.reset) > return; > /* store LSE type 1 */ > -put_marker(pb, LSE); > -put_bits(pb, 16, 13); > -put_bits(pb, 8, 1); > -put_bits(pb, 16, state->maxval); > -put_bits(pb, 16, state->T1); > -put_bits(pb, 16, state->T2); > -put_bits(pb, 16, state->T3); > -put_bits(pb, 16, state->reset); > +put_markeru(pb, LSE); > +bytestream2_put_be16u(pb, 13); > +bytestream2_put_byteu(pb, 1); > +bytestream2_put_be16u(pb, state->maxval); > +bytestream2_put_be16u(pb, state->T1); > +bytestream2_put_be16u(pb, state->T2); > +bytestream2_put_be16u(pb, state->T3); > +bytestream2_put_be16u(pb, state->reset); > } > > static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt, > @@ -258,7 +271,8 @@ static int encode_picture_ls(AVCodecContext *avctx, > AVPacket *pkt, > { > JPEGLSContext *ctx = avctx->priv_data; > const AVFrame *const p = pict; > -PutBitContext pb, pb2; > +PutByteContext pb; > +PutBitContext pb2; > GetBitContext gb; > uint8_t *buf2 = NULL; > uint8_t *zero = NULL; > @@ -289,33 +303,33 @@ FF_ENABLE_DEPRECATION_WARNINGS > if (!buf2) > goto memfail; > > -init_put_bits(&pb, pkt->data, pkt->size); > +bytestream2_init_writer(&pb, pkt->data, pkt->size); > init_put_bits(&pb2, buf2, pkt->size); > > /* write our own JPEG header, can't use mjpeg_picture_header */ > -put_marker(&pb, SOI); > -put_marker(&pb, SOF48); > -put_bits(&pb, 16, 8 + comps * 3); // header size depends on components > -put_bits(&pb, 8, (avctx->pix_fmt == AV_PIX_FMT_GRAY16) ? 16 : 8); // bpp > -put_bits(&pb, 16, avctx->height); > -put_bits(&pb, 16, avctx->width); > -put_bits(&pb, 8, comps); // components > +put_markeru(&pb, SOI); > +put_markeru(&pb, SOF48); > +bytestream2_put_be16u(&pb, 8 + comps * 3); // header size depends on > components > +bytestream2_put_byteu(&pb, (avctx->pix_fmt == AV_PIX_FMT_GRAY16) ? 16 : > 8); // bpp > +bytestream2_put_be16u(&pb, avctx->height); > +bytestream2_put_be16u(&pb, avctx->width); > +bytestream2_put_byteu(&pb, comps); // components > for (i = 1; i <= comps; i++) { > -put_bits(&pb, 8, i); // component ID > -put_bits(&pb, 8, 0x11); // subsampling: none > -put_bits(&pb, 8, 0); // Tiq, used by JPEG-LS ext > +bytestream2_put_byteu(&pb, i); // component ID > +bytestream2_put_byteu(&pb, 0x11); // subsampling: none > +bytestream2_put_byteu(&pb, 0); // Tiq, used by JPEG-LS ext > } > > -put_marker(&pb, SOS); > -put_bits(&pb, 16, 6 + comps * 2); > -put_bits(&pb, 8, comps); > +put_markeru(&pb, SOS); > +bytestream2_put_be16u(&pb, 6 + comps * 2); > +bytestream2_put_byteu(&pb, comps); > for (i = 1; i <= comps; i++) { > -put_bits(&pb, 8, i); // component ID > -put_bits(&pb, 8, 0); // mapping index: none > +bytestream2_put_byteu(&pb, i); // component ID > +bytestream2_put_byteu(&pb, 0); // mapping index: none > } > -put_bits(&pb, 8, ctx->pred); > -put_bits(&pb, 8
Re: [FFmpeg-devel] [PATCH V2] Added MKV tag for AVS2 video codec
Ze Yuan: > From ea96e70874c87b003af1fb3fcd5c792b3292bf29 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?=E9=83=91=E5=A4=A9=E6=B3=A2?= > Date: Sun, 6 Sep 2020 18:35:51 +0800 > Subject: [PATCH] Added MKV tag for AVS2 video codec > > avs2 (IEEE 1857.4) video codec > > MKV spec: V_AVS2 Codec ID: V_AVS2 Codec Name: AVS2-P2/IEEE.1857.4 > (https://github.com/xatabhk/matroska-specification/blob/master/codec_specs.md) > > Standard document: > 1857.4-2018 - IEEE Standard for Second-Generation IEEE 1857 Video Coding > (https://ieeexplore.ieee.org/document/8821610) > > Encoding tool: > Ffmpeg with avs2 enabled: https://github.com/xatabhk/FFmpeg-avs2-avs3/releases > Command line: > > ffmpeg -i .mp4 -vcodec avs2 -acodec copy _avs2.mkv > ffmpeg -i .mp4 -vcodec avs2 -speed_level 4 -acodec copy > _avs2.mkv` > > Players: > (1) Ffmpeg with avs2 enabled: > (https://github.com/xatabhk/FFmpeg-avs2-avs3/releases): > Command line: > > ffplay _avs2.mkv` > (2) VLC 3.0.x with avs2 enabled: > https://github.com/xatabhk/vlc-3.0-avs2-avs3/releases > (3) Mpc-hc 1.9.x with avs2 enabled: > https://gitee.com/zhengtianbo/cavs-avs2-avs3_decoder_added_to_mpc_hc/releases > > Avs2-MKV samples: > https://github.com/xatabhk/avs2-avs3-video-samples > > --- > libavformat/matroska.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libavformat/matroska.c b/libavformat/matroska.c > index 7c56aba403..2ce60c6277 100644 > --- a/libavformat/matroska.c > +++ b/libavformat/matroska.c > @@ -78,6 +78,7 @@ const CodecTags ff_mkv_codec_tags[]={ > {"S_HDMV/TEXTST", AV_CODEC_ID_HDMV_TEXT_SUBTITLE}, > > {"V_AV1", AV_CODEC_ID_AV1}, > +{"V_AVS2" , AV_CODEC_ID_AVS2}, > {"V_DIRAC" , AV_CODEC_ID_DIRAC}, > {"V_FFV1" , AV_CODEC_ID_FFV1}, > {"V_MJPEG" , AV_CODEC_ID_MJPEG}, > I just noticed that an official codec mapping for AVS2 has been added months ago; this solves my main objection to your earlier patch [1]. Will this a bit and apply it if nothing turns up. Sorry for not noticing this earlier. - Andreas Rheinhardt [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-August/268135.html ___ 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] libavcodec/vaapi_encode: Change libva call to async way
From: "Chen,Wenbin" Fix: #7706. After commit 5fdcf85bbffe7451c2, vaapi encoder's performance drop 20~30%. One reason is that vaRenderPicture() and vaSyncSurface() are called at the same time (vaRenderPicture() always followed by a vaSyncSurface()). Now I changed them to be called in a asynchronous way, which will make better use of hardware. Another reason of performance drop is that in old version, ffmpeg-vaapi use CQP as default while the ffmpeg-vaapi of lastest version does not, so the same command line will have a even bigger performance gap. To test this patch you'd better specify the bitrate (-b:v XXX). Signed-off-by: Wenbin CHEN --- libavcodec/vaapi_encode.c | 42 +-- libavcodec/vaapi_encode.h | 3 +++ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 518e5b2c00..851dea3fc2 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -950,8 +950,10 @@ static int vaapi_encode_pick_next(AVCodecContext *avctx, if (!pic && ctx->end_of_stream) { --b_counter; pic = ctx->pic_end; -if (pic->encode_issued) +if (pic->encode_complete) return AVERROR_EOF; +else if (pic->encode_issued) +return AVERROR(EAGAIN); } if (!pic) { @@ -1176,20 +1178,34 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) return AVERROR(EAGAIN); } -pic = NULL; -err = vaapi_encode_pick_next(avctx, &pic); -if (err < 0) -return err; -av_assert0(pic); +if (av_fifo_size(ctx->encode_fifo) == 0) { +while (!err) { +pic = NULL; +err = vaapi_encode_pick_next(avctx, &pic); +if (err == AVERROR(EAGAIN)) +break; +else if (err < 0) +return err; +av_assert0(pic); -pic->encode_order = ctx->encode_order++; +pic->encode_order = ctx->encode_order++; -err = vaapi_encode_issue(avctx, pic); -if (err < 0) { -av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err); -return err; +err = vaapi_encode_issue(avctx, pic); +if (err < 0) { +av_log(avctx, AV_LOG_ERROR, "Encode failed: %d.\n", err); +return err; +} + +av_fifo_generic_write(ctx->encode_fifo, &pic, sizeof(pic), NULL); +} } +if (av_fifo_size(ctx->encode_fifo) == 0) +return err; + +av_fifo_generic_read(ctx->encode_fifo, &pic, sizeof(pic), NULL); +ctx->encode_order = pic->encode_order+1; + err = vaapi_encode_output(avctx, pic, pkt); if (err < 0) { av_log(avctx, AV_LOG_ERROR, "Output failed: %d.\n", err); @@ -2519,6 +2535,10 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) } } +ctx->encode_fifo = av_fifo_alloc((MAX_PICTURE_REFERENCES+1)* sizeof(VAAPIEncodePicture *)); +if (!ctx->encode_fifo) +return AVERROR(ENOMEM); + return 0; fail: diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index b41604a883..89fe8de466 100644 --- a/libavcodec/vaapi_encode.h +++ b/libavcodec/vaapi_encode.h @@ -29,6 +29,7 @@ #include "libavutil/hwcontext.h" #include "libavutil/hwcontext_vaapi.h" +#include "libavutil/fifo.h" #include "avcodec.h" #include "hwconfig.h" @@ -345,6 +346,8 @@ typedef struct VAAPIEncodeContext { int roi_warned; AVFrame *frame; + +AVFifoBuffer *encode_fifo; } VAAPIEncodeContext; enum { -- 2.25.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] Next major release?
4.3 was cut from master on 2020-06-08 (from https://ffmpeg.org/download.html), and there have been a lot of good things landed in master since then. Are there plans for a 4.4? I'm aware that I can (and I sometimes do, when I want to make a change) build from the git main development branch, but for others building from source / packaging or wrapping the API, only releases get built, so its useful if there is a packaged release. Brad ___ 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] Next major release?
Brad Hards: > 4.3 was cut from master on 2020-06-08 (from > https://ffmpeg.org/download.html), and there have been a lot of good things > landed in > master since then. > > > > Are there plans for a 4.4? > > > > I'm aware that I can (and I sometimes do, when I want to make a change) build > from the git main development branch, but for others > building from source / packaging or wrapping the API, only releases get > built, so its useful if there is a packaged release. > We expect to make a new release soon. And we also expect to bump major soon. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] Next major release?
> 2021年3月8日 上午11:43,Andreas Rheinhardt 写道: > > Brad Hards: >> 4.3 was cut from master on 2020-06-08 (from >> https://ffmpeg.org/download.html), and there have been a lot of good things >> landed in >> master since then. >> >> >> >> Are there plans for a 4.4? >> >> >> >> I'm aware that I can (and I sometimes do, when I want to make a change) >> build from the git main development branch, but for others >> building from source / packaging or wrapping the API, only releases get >> built, so its useful if there is a packaged release. >> > We expect to make a new release soon. And we also expect to bump major soon. Hi Andreas, Major means 5.0 version? > > - 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 Steven Liu ___ 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 V5 1/5] libavfilter/dnn: add ff_dnn_set_proc to set pre/post proc
Signed-off-by: Guo, Yejun --- libavfilter/dnn_filter_common.c | 7 +++ libavfilter/dnn_filter_common.h | 1 + libavfilter/dnn_interface.h | 6 -- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn_filter_common.c b/libavfilter/dnn_filter_common.c index 413adba406..2a1d045be1 100644 --- a/libavfilter/dnn_filter_common.c +++ b/libavfilter/dnn_filter_common.c @@ -64,6 +64,13 @@ int ff_dnn_init(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *fil return 0; } +int ff_dnn_set_proc(DnnContext *ctx, PrePostProc pre_proc, PrePostProc post_proc) +{ +ctx->model->pre_proc = pre_proc; +ctx->model->post_proc = post_proc; +return 0; +} + DNNReturnType ff_dnn_get_input(DnnContext *ctx, DNNData *input) { return ctx->model->get_input(ctx->model->model, input, ctx->model_inputname); diff --git a/libavfilter/dnn_filter_common.h b/libavfilter/dnn_filter_common.h index 79c4d3efe3..4810c7baaf 100644 --- a/libavfilter/dnn_filter_common.h +++ b/libavfilter/dnn_filter_common.h @@ -48,6 +48,7 @@ typedef struct DnnContext { int ff_dnn_init(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *filter_ctx); +int ff_dnn_set_proc(DnnContext *ctx, PrePostProc pre_proc, PrePostProc post_proc); DNNReturnType ff_dnn_get_input(DnnContext *ctx, DNNData *input); DNNReturnType ff_dnn_get_output(DnnContext *ctx, int input_width, int input_height, int *output_width, int *output_height); DNNReturnType ff_dnn_execute_model(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame); diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h index d3a0c58a61..c92434ee55 100644 --- a/libavfilter/dnn_interface.h +++ b/libavfilter/dnn_interface.h @@ -63,6 +63,8 @@ typedef struct DNNData{ DNNColorOrder order; } DNNData; +typedef int (*PrePostProc)(AVFrame *frame, DNNData *model, AVFilterContext *filter_ctx); + typedef struct DNNModel{ // Stores model that can be different for different backends. void *model; @@ -80,10 +82,10 @@ typedef struct DNNModel{ const char *output_name, int *output_width, int *output_height); // set the pre process to transfer data from AVFrame to DNNData // the default implementation within DNN is used if it is not provided by the filter -int (*pre_proc)(AVFrame *frame_in, DNNData *model_input, AVFilterContext *filter_ctx); +PrePostProc pre_proc; // set the post process to transfer data from DNNData to AVFrame // the default implementation within DNN is used if it is not provided by the filter -int (*post_proc)(AVFrame *frame_out, DNNData *model_output, AVFilterContext *filter_ctx); +PrePostProc post_proc; } DNNModel; // Stores pointers to functions for loading, executing, freeing DNN models for one of the backends. -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH V5 2/5] libavfilter/bbox.h: add BoundingBoxHeader and BoundingBox
They will be used for filters such as detect and classify. Signed-off-by: Guo, Yejun --- libavfilter/bbox.h | 51 ++ 1 file changed, 51 insertions(+) diff --git a/libavfilter/bbox.h b/libavfilter/bbox.h index 116158d59e..3ba8ce5b47 100644 --- a/libavfilter/bbox.h +++ b/libavfilter/bbox.h @@ -22,6 +22,57 @@ #define AVFILTER_BBOX_H #include +#include "libavutil/rational.h" + +typedef struct BoundingBox { +/** + * Distance in pixels from the top edge of the frame to top + * and bottom, and from the left edge of the frame to left and + * right, defining the bounding box. + */ +int top; +int left; +int bottom; +int right; + +#define BBOX_LABEL_NAME_MAX_SIZE 32 + +/** + * Detect result with confidence + */ +char detect_label[BBOX_LABEL_NAME_MAX_SIZE]; +AVRational detect_confidence; + +/** + * At most 4 classifications based on the detected bounding box. + * For example, we can get max 4 different attributes with 4 different + * DNN models on one bounding box. + * classify_count is zero if no classification. + */ +#define AV_NUM_BBOX_CLASSIFY 4 +uint32_t classify_count; +char classify_labels[AV_NUM_BBOX_CLASSIFY][BBOX_LABEL_NAME_MAX_SIZE]; +AVRational classify_confidences[AV_NUM_BBOX_CLASSIFY]; +} BoundingBox; + +typedef struct BoundingBoxHeader { +/** + * Information about how the bounding box is generated. + * for example, the DNN model name. + */ +char source[128]; + +/** + * Must be set to the size of BoundingBox (that is, + * sizeof(BoundingBox)). + */ +uint32_t bbox_size; + +/** + * Pointer to the array of BoundingBox. + */ +BoundingBox bboxes[]; +} BoundingBoxHeader; typedef struct FFBoundingBox { int x1, x2, y1, y2; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH V5 3/5] libavutil: add side data AV_FRAME_DATA_BOUNDING_BOXES
Signed-off-by: Guo, Yejun --- doc/APIchanges| 2 ++ libavutil/frame.c | 1 + libavutil/frame.h | 5 + 3 files changed, 8 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 4027d599e7..b83409a412 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,8 @@ libavutil: 2017-10-21 API changes, most recent first: +2021-03-xx - xx - lavu 56.xx.100 - frame.h + Add AV_FRAME_DATA_BOUNDING_BOXES 2021-03-04 - xx - lavc 58.128.101 - avcodec.h Enable err_recognition to be set for encoders. diff --git a/libavutil/frame.c b/libavutil/frame.c index eab51b6a32..53868a2410 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -852,6 +852,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type) case AV_FRAME_DATA_VIDEO_ENC_PARAMS:return "Video encoding parameters"; case AV_FRAME_DATA_SEI_UNREGISTERED:return "H.26[45] User Data Unregistered SEI message"; case AV_FRAME_DATA_FILM_GRAIN_PARAMS: return "Film grain parameters"; +case AV_FRAME_DATA_BOUNDING_BOXES: return "Bounding boxes"; } return NULL; } diff --git a/libavutil/frame.h b/libavutil/frame.h index 1aeafef6de..3fbe15c47e 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -198,6 +198,11 @@ enum AVFrameSideDataType { * Must be present for every frame which should have film grain applied. */ AV_FRAME_DATA_FILM_GRAIN_PARAMS, + +/** + * The data is for internal use by libavfilter. + */ +AV_FRAME_DATA_BOUNDING_BOXES, }; enum AVActiveFormatDescription { -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH V5 4/5] libavfilter: show side data of bounding box
Signed-off-by: Guo, Yejun --- libavfilter/f_sidedata.c | 2 ++ libavfilter/vf_showinfo.c | 38 ++ 2 files changed, 40 insertions(+) diff --git a/libavfilter/f_sidedata.c b/libavfilter/f_sidedata.c index 3757723375..912fb0d881 100644 --- a/libavfilter/f_sidedata.c +++ b/libavfilter/f_sidedata.c @@ -71,6 +71,7 @@ static const AVOption filt_name##_options[] = { \ { "S12M_TIMECOD", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_S12M_TIMECODE }, 0, 0, FLAGS, "type" }, \ { "DYNAMIC_HDR_PLUS", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, 0, 0, FLAGS, "type" }, \ { "REGIONS_OF_INTEREST","", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_REGIONS_OF_INTEREST}, 0, 0, FLAGS, "type" }, \ +{ "BOUNDING_BOXES", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_BOUNDING_BOXES }, 0, 0, FLAGS, "type" }, \ { "SEI_UNREGISTERED", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SEI_UNREGISTERED }, 0, 0, FLAGS, "type" }, \ { NULL } \ } @@ -100,6 +101,7 @@ static const AVOption filt_name##_options[] = { \ { "S12M_TIMECOD", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_S12M_TIMECODE }, 0, 0, FLAGS, "type" }, \ { "DYNAMIC_HDR_PLUS", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, 0, 0, FLAGS, "type" }, \ { "REGIONS_OF_INTEREST","", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_REGIONS_OF_INTEREST}, 0, 0, FLAGS, "type" }, \ +{ "BOUNDING_BOXES", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_BOUNDING_BOXES }, 0, 0, FLAGS, "type" }, \ { "SEI_UNREGISTERED", "", 0, AV_OPT_TYPE_CONST, {.i64 = AV_FRAME_DATA_SEI_UNREGISTERED }, 0, 0, FLAGS, "type" }, \ { NULL } \ } diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index 6208892005..a0060647c6 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -38,6 +38,7 @@ #include "libavutil/timecode.h" #include "libavutil/mastering_display_metadata.h" #include "libavutil/video_enc_params.h" +#include "bbox.h" #include "avfilter.h" #include "internal.h" @@ -153,6 +154,40 @@ static void dump_roi(AVFilterContext *ctx, const AVFrameSideData *sd) } } +static void dump_boundingbox(AVFilterContext *ctx, const AVFrameSideData *sd) +{ +int nb_bbox; +const BoundingBoxHeader *header; +const BoundingBox *bbox; +uint32_t bbox_size, array_size; + +header = (const BoundingBoxHeader *)sd->data; +bbox_size = header->bbox_size; +array_size = sd->size - sizeof(*header); +if (!bbox_size || array_size % bbox_size != 0 || bbox_size != sizeof(*bbox)) { +av_log(ctx, AV_LOG_ERROR, "Invalid BoundingBoxHeader.bbox_size.\n"); +return; +} + +nb_bbox = array_size / bbox_size; +bbox = header->bboxes; + +av_log(ctx, AV_LOG_INFO, "bounding boxes:\n"); +av_log(ctx, AV_LOG_INFO, "source: %s\n", header->source); +for (int i = 0; i < nb_bbox; i++) { +av_log(ctx, AV_LOG_INFO, "index: %d, region: (%d, %d) -> (%d, %d), label: %s, confidence: %d/%d.\n", + i, bbox->left, bbox->top, bbox->right, bbox->bottom, + bbox->detect_label, bbox->detect_confidence.num, bbox->detect_confidence.den); +if (bbox->classify_count > 0) { +for (int j = 0; j < bbox->classify_count; j++) { +av_log(ctx, AV_LOG_INFO, "\t\tclassify: label: %s, confidence: %d/%d.\n", + bbox->classify_labels[j], bbox->classify_confidences[j].num, bbox->classify_confidences[j].den); +} +} +bbox++; +} +} + static void dump_mastering_display(AVFilterContext *ctx, const AVFrameSideData *sd) { const AVMasteringDisplayMetadata *mastering_display; @@ -494,6 +529,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) case AV_FRAME_DATA_REGIONS_OF_INTEREST: dump_roi(ctx, sd); break; +case AV_FRAME_DATA_BOUNDING_BOXES: +dump_boundingbox(ctx, sd); +break; case AV_FRAME_DATA_MASTERING_DISPLAY_METADATA: dump_mastering_display(ctx, sd); break; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH V5 5/5] libavfilter: add filter dnn_detect for object detection
Below are the example steps to do object detection: 1. download and install l_openvino_toolkit_p_2021.1.110.tgz from https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit/download.html or, we can get source code (tag 2021.1), build and install. 2. export LD_LIBRARY_PATH with openvino settings, for example: .../deployment_tools/inference_engine/lib/intel64/:.../deployment_tools/inference_engine/external/tbb/lib/ 3. rebuild ffmpeg from source code with configure option: --enable-libopenvino --extra-cflags='-I.../deployment_tools/inference_engine/include/' --extra-ldflags='-L.../deployment_tools/inference_engine/lib/intel64' 4. download model files and test image wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/face-detection-adas-0001.bin wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/face-detection-adas-0001.xml wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/face-detection-adas-0001.label wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/images/cici.jpg 5. run ffmpeg with: ./ffmpeg -i cici.jpg -vf dnn_detect=dnn_backend=openvino:model=face-detection-adas-0001.xml:input=data:output=detection_out:confidence=0.6:labels=face-detection-adas-0001.label,showinfo -f null - We'll see the detect result as below: [Parsed_showinfo_1 @ 0x55978db02dc0] side data - bounding boxes: [Parsed_showinfo_1 @ 0x55978db02dc0] source: face-detection-adas-0001.xml [Parsed_showinfo_1 @ 0x55978db02dc0] index: 0, region: (1005, 813) -> (1086, 905), label: face, confidence: 1/1. [Parsed_showinfo_1 @ 0x55978db02dc0] index: 1, region: (888, 839) -> (967, 926), label: face, confidence: 6917/1. There are two faces detected with confidence 100% and 69.17%. Signed-off-by: Guo, Yejun --- configure | 1 + doc/filters.texi | 40 +++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/dnn/dnn_backend_openvino.c | 12 + libavfilter/vf_dnn_detect.c| 426 + 6 files changed, 481 insertions(+) create mode 100644 libavfilter/vf_dnn_detect.c diff --git a/configure b/configure index d11942fced..f28c2b27e5 100755 --- a/configure +++ b/configure @@ -3548,6 +3548,7 @@ derain_filter_select="dnn" deshake_filter_select="pixelutils" deshake_opencl_filter_deps="opencl" dilation_opencl_filter_deps="opencl" +dnn_detect_filter_select="dnn" dnn_processing_filter_select="dnn" drawtext_filter_deps="libfreetype" drawtext_filter_suggest="libfontconfig libfribidi" diff --git a/doc/filters.texi b/doc/filters.texi index eb0a0b6a0b..9636cc703b 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10133,6 +10133,46 @@ ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2 @end example @end itemize +@section dnn_detect + +Do object detection with deep neural networks. + +The filter accepts the following options: + +@table @option +@item dnn_backend +Specify which DNN backend to use for model loading and execution. This option accepts +only openvino now, tensorflow backends will be added. + +@item model +Set path to model file specifying network architecture and its parameters. +Note that different backends use different file formats. + +@item input +Set the input name of the dnn network. + +@item output +Set the output name of the dnn network. + +@item confidence +Set the confidence threshold (default: 0.5). + +@item labels +Set path to label file specifying the mapping between label id and name. +Each label name is written in one line, tailing spaces and empty lines are skipped. +The first line is the name of label id 0 (usually it is 'background'), +and the second line is the name of label id 1, etc. +The label id is considered as name if the label file is not provided. + +@item backend_configs +Set the configs to be passed into backend + +@item async +use DNN async execution if set (default: set), +roll back to sync execution if the backend does not support async. + +@end table + @anchor{dnn_processing} @section dnn_processing diff --git a/libavfilter/Makefile b/libavfilter/Makefile index b2c254ea67..b77f2276a4 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -245,6 +245,7 @@ OBJS-$(CONFIG_DILATION_FILTER) += vf_neighbor.o OBJS-$(CONFIG_DILATION_OPENCL_FILTER)+= vf_neighbor_opencl.o opencl.o \ opencl/neighbor.o OBJS-$(CONFIG_DISPLACE_FILTER) += vf_displace.o framesync.o +OBJS-$(CONFIG_DNN_DETECT_FILTER) += vf_dnn_detect.o OBJS-$(CONFIG_DNN_PROCESSING_FILTER) += vf_dnn_processing.o OBJS-$(CONFIG_DOUBLEWEAVE_FILTER)+= vf_weave.o OBJS-$(CONFIG_DRAWBOX_FILTER)+= vf_drawbox.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 0872c6e0f2..0d2bf7bbee 100644 --- a/libavfilter/allfilt