Re: [FFmpeg-devel] [PATCH v10 3/6] avformat/flvenc: support mux av1 in enhanced flv

2023-06-02 Thread Steven Liu
Tristan Matthews  于2023年6月2日周五 12:50写道:
>
> On Mon, May 15, 2023 at 4:43 AM Steven Liu  wrote:
> >
> > Signed-off-by: Steven Liu 
> > ---
> >  libavformat/Makefile |  2 +-
> >  libavformat/flvenc.c | 22 ++
> >  2 files changed, 19 insertions(+), 5 deletions(-)
> >
> > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > index 1ef3d15467..c868e1626c 100644
> > --- a/libavformat/Makefile
> > +++ b/libavformat/Makefile
> > @@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+= flacenc.o 
> > flacenc_header.o \
> >  OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
> >  OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
> >  OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
> > -OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o
> > +OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o
> >  OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
> >  OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
> >  OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
> > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > index 35e198fa15..c1784b332d 100644
> > --- a/libavformat/flvenc.c
> > +++ b/libavformat/flvenc.c
> > @@ -28,6 +28,7 @@
> >  #include "libavcodec/mpeg4audio.h"
> >  #include "avio.h"
> >  #include "avc.h"
> > +#include "av1.h"
> >  #include "hevc.h"
> >  #include "avformat.h"
> >  #include "flv.h"
> > @@ -48,6 +49,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
> >  { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A },
> >  { AV_CODEC_ID_H264, FLV_CODECID_H264 },
> >  { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
> > +{ AV_CODEC_ID_AV1,  MKBETAG('a', 'v', '0', '1') },
> >  { AV_CODEC_ID_NONE, 0 }
> >  };
> >
> > @@ -491,7 +493,8 @@ static void flv_write_codec_header(AVFormatContext* s, 
> > AVCodecParameters* par, i
> >  FLVContext *flv = s->priv_data;
> >
> >  if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == 
> > AV_CODEC_ID_H264
> > -|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
> > AV_CODEC_ID_HEVC) {
> > +|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
> > AV_CODEC_ID_HEVC
> > +|| par->codec_id == AV_CODEC_ID_AV1) {
> >  int64_t pos;
> >  avio_w8(pb,
> >  par->codec_type == AVMEDIA_TYPE_VIDEO ?
> > @@ -537,6 +540,9 @@ static void flv_write_codec_header(AVFormatContext* s, 
> > AVCodecParameters* par, i
> >  if (par->codec_id == AV_CODEC_ID_HEVC) {
> >  avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); 
> > // ExVideoTagHeader mode with PacketTypeSequenceStart
> >  avio_write(pb, "hvc1", 4);
> > +} else if (par->codec_id == AV_CODEC_ID_AV1) {
> > +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart);
> > +avio_write(pb, "av01", 4);
> >  } else {
> >  avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
> >  avio_w8(pb, 0); // AVC sequence header
> > @@ -545,6 +551,8 @@ static void flv_write_codec_header(AVFormatContext* s, 
> > AVCodecParameters* par, i
> >
> >  if (par->codec_id == AV_CODEC_ID_HEVC)
> >  ff_isom_write_hvcc(pb, par->extradata, 
> > par->extradata_size, 0);
> > +else if (par->codec_id == AV_CODEC_ID_AV1)
> > +ff_isom_write_av1c(pb, par->extradata, 
> > par->extradata_size, 1);
> >  else
> >  ff_isom_write_avcc(pb, par->extradata, 
> > par->extradata_size);
> >  }
> > @@ -843,13 +851,15 @@ static int flv_write_packet(AVFormatContext *s, 
> > AVPacket *pkt)
> >  if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == 
> > AV_CODEC_ID_VP6A ||
> >  par->codec_id == AV_CODEC_ID_VP6  || par->codec_id == 
> > AV_CODEC_ID_AAC)
> >  flags_size = 2;
> > -else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
> > AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC)
> > +else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
> > AV_CODEC_ID_MPEG4 ||
> > + par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == 
> > AV_CODEC_ID_AV1)
> >  flags_size = 5;
> >  else
> >  flags_size = 1;
> >
> >  if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == 
> > AV_CODEC_ID_H264
> > -|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
> > AV_CODEC_ID_HEVC) {
> > +|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
> > AV_CODEC_ID_HEVC
> > +|| par->codec_id == AV_CODEC_ID_AV1) {
> >  size_t side_size;
> >  uint8_t *side = av_packet_get_side_data(pkt, 
> > AV_PKT_DATA_NEW_EXTRADATA, &side_size);
> >  if (side && side_size > 0 && (side_size != par->extradata_size || 
> > memcmp(side, par->extradata, side_size))) {
> > @@ -869,7 +879,8 @@ static int flv_write_packet(AVF

[FFmpeg-devel] [PATCH v11 1/6] avformat/flvenc: support mux hevc in enhanced flv

2023-06-02 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/Makefile |  2 +-
 libavformat/flv.h| 15 +++
 libavformat/flvenc.c | 41 +++--
 3 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index f8ad7c6a11..1ef3d15467 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+= flacenc.o 
flacenc_header.o \
 OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
 OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
 OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o
+OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o
 OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
 OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
 OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
diff --git a/libavformat/flv.h b/libavformat/flv.h
index 3571b90279..91e0a4140c 100644
--- a/libavformat/flv.h
+++ b/libavformat/flv.h
@@ -35,6 +35,12 @@
 
 #define FLV_VIDEO_FRAMETYPE_OFFSET   4
 
+/* Extended VideoTagHeader
+ * defined in reference link:
+ * https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
+ * */
+#define FLV_IS_EX_HEADER  0x80
+
 /* bitmasks to isolate specific values */
 #define FLV_AUDIO_CHANNEL_MASK0x01
 #define FLV_AUDIO_SAMPLESIZE_MASK 0x02
@@ -112,6 +118,15 @@ enum {
 FLV_CODECID_MPEG4   = 9,
 };
 
+enum {
+PacketTypeSequenceStart = 0,
+PacketTypeCodedFrames   = 1,
+PacketTypeSequenceEnd   = 2,
+PacketTypeCodedFramesX  = 3,
+PacketTypeMetadata  = 4,
+PacketTypeMPEG2TSSequenceStart  = 5,
+};
+
 enum {
 FLV_FRAME_KEY= 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< key frame 
(for AVC, a seekable frame)
 FLV_FRAME_INTER  = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< inter 
frame (for AVC, a non-seekable frame)
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 721f062811..aed0946a2e 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -28,6 +28,7 @@
 #include "libavcodec/mpeg4audio.h"
 #include "avio.h"
 #include "avc.h"
+#include "hevc.h"
 #include "avformat.h"
 #include "flv.h"
 #include "internal.h"
@@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
 { AV_CODEC_ID_VP6,  FLV_CODECID_VP6 },
 { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A },
 { AV_CODEC_ID_H264, FLV_CODECID_H264 },
+{ AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
 { AV_CODEC_ID_NONE, 0 }
 };
 
@@ -489,7 +491,7 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par, i
 FLVContext *flv = s->priv_data;
 
 if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
-|| par->codec_id == AV_CODEC_ID_MPEG4) {
+|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
AV_CODEC_ID_HEVC) {
 int64_t pos;
 avio_w8(pb,
 par->codec_type == AVMEDIA_TYPE_VIDEO ?
@@ -532,10 +534,19 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par, i
 }
 avio_write(pb, par->extradata, par->extradata_size);
 } else {
-avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
-avio_w8(pb, 0); // AVC sequence header
-avio_wb24(pb, 0); // composition time
-ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
+if (par->codec_id == AV_CODEC_ID_HEVC) {
+avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart | 
FLV_FRAME_KEY); // ExVideoTagHeader mode with PacketTypeSequenceStart
+avio_write(pb, "hvc1", 4);
+} else {
+avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
+avio_w8(pb, 0); // AVC sequence header
+avio_wb24(pb, 0); // composition time
+}
+
+if (par->codec_id == AV_CODEC_ID_HEVC)
+ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0);
+else
+ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
 }
 data_size = avio_tell(pb) - pos;
 avio_seek(pb, -data_size - 10, SEEK_CUR);
@@ -821,6 +832,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 unsigned ts;
 int size = pkt->size;
 uint8_t *data = NULL;
+uint8_t frametype = pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : 
FLV_FRAME_INTER;
 int flags = -1, flags_size, ret = 0;
 int64_t cur_offset = avio_tell(pb);
 
@@ -832,13 +844,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A 
||
 par->codec_id == AV_CODEC_ID_VP6  || par->codec_id == AV_CODEC_ID_AAC)
 flags_size = 2;
-else if (par->codec_id == AV_CODEC

[FFmpeg-devel] [PATCH v11 0/6] Support enhanced flv in FFmpeg

2023-06-02 Thread Steven Liu
Reference file: 
https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
The Enhanced flv has been supported by OBS, Simple Realtime Server, mpegts.js.
you can publish hevc, av1 or vp9 codec stream to Youtube over rtmp.
The enhanced flv documentation contributors include
Jean-Baptiste Kempf (FFmpeg, VideoLAN).
So this should be support by ffmpeg too.

v8:
Support vp9 codec according to enhanced flv.
Support PacketTypeCodedFrames type for hevc in flv.
v9:
Add dependency codec object files for flvenc in Makefile.
Move the hevc,av1,vp9 codec out of FF_COMPLIANCE_UNOFFICIAL.

v10:
modify first patch comment like the others before commit.
exheader mode should only happened in video stream this patchset.

v11:
use IsExHeader|FrameType in enhanced flv muxer,

Steven Liu (6):
  avformat/flvenc: support mux hevc in enhanced flv
  avformat/flvdec: support demux hevc in enhanced flv
  avformat/flvenc: support mux av1 in enhanced flv
  avformat/flvdec: support demux av1 in enhanced flv
  avformat/flvenc: support mux vp9 in enhanced flv
  avformat/flvdec: support demux vp9 in enhanced flv

 libavformat/Makefile |  2 +-
 libavformat/flv.h| 15 +
 libavformat/flvdec.c | 73 +++-
 libavformat/flvenc.c | 61 ++--
 4 files changed, 132 insertions(+), 19 deletions(-)

-- 
2.40.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v11 3/6] avformat/flvenc: support mux av1 in enhanced flv

2023-06-02 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/Makefile |  2 +-
 libavformat/flvenc.c | 22 ++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 1ef3d15467..c868e1626c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+= flacenc.o 
flacenc_header.o \
 OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
 OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
 OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o
+OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o
 OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
 OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
 OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index aed0946a2e..99fa1bd723 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -28,6 +28,7 @@
 #include "libavcodec/mpeg4audio.h"
 #include "avio.h"
 #include "avc.h"
+#include "av1.h"
 #include "hevc.h"
 #include "avformat.h"
 #include "flv.h"
@@ -48,6 +49,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
 { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A },
 { AV_CODEC_ID_H264, FLV_CODECID_H264 },
 { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
+{ AV_CODEC_ID_AV1,  MKBETAG('a', 'v', '0', '1') },
 { AV_CODEC_ID_NONE, 0 }
 };
 
@@ -491,7 +493,8 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par, i
 FLVContext *flv = s->priv_data;
 
 if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
-|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
AV_CODEC_ID_HEVC) {
+|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
AV_CODEC_ID_HEVC
+|| par->codec_id == AV_CODEC_ID_AV1) {
 int64_t pos;
 avio_w8(pb,
 par->codec_type == AVMEDIA_TYPE_VIDEO ?
@@ -537,6 +540,9 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par, i
 if (par->codec_id == AV_CODEC_ID_HEVC) {
 avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart | 
FLV_FRAME_KEY); // ExVideoTagHeader mode with PacketTypeSequenceStart
 avio_write(pb, "hvc1", 4);
+} else if (par->codec_id == AV_CODEC_ID_AV1) {
+avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart | 
FLV_FRAME_KEY);
+avio_write(pb, "av01", 4);
 } else {
 avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
 avio_w8(pb, 0); // AVC sequence header
@@ -545,6 +551,8 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par, i
 
 if (par->codec_id == AV_CODEC_ID_HEVC)
 ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0);
+else if (par->codec_id == AV_CODEC_ID_AV1)
+ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 1);
 else
 ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
 }
@@ -844,13 +852,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A 
||
 par->codec_id == AV_CODEC_ID_VP6  || par->codec_id == AV_CODEC_ID_AAC)
 flags_size = 2;
-else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC)
+else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
AV_CODEC_ID_MPEG4 ||
+ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == 
AV_CODEC_ID_AV1)
 flags_size = 5;
 else
 flags_size = 1;
 
 if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
-|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
AV_CODEC_ID_HEVC) {
+|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
AV_CODEC_ID_HEVC
+|| par->codec_id == AV_CODEC_ID_AV1) {
 size_t side_size;
 uint8_t *side = av_packet_get_side_data(pkt, 
AV_PKT_DATA_NEW_EXTRADATA, &side_size);
 if (side && side_size > 0 && (side_size != par->extradata_size || 
memcmp(side, par->extradata, side_size))) {
@@ -870,7 +880,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
*pkt)
"Packets are not in the proper order with respect to DTS\n");
 return AVERROR(EINVAL);
 }
-if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC) {
+if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
AV_CODEC_ID_MPEG4 ||
+par->codec_id == AV_CODEC_ID_HEVC ||  par->codec_id == 
AV_CODEC_ID_AV1) {
 if (pkt->pts == AV_NOPTS_VALUE) {
 a

[FFmpeg-devel] [PATCH v11 2/6] avformat/flvdec: support demux hevc in enhanced flv

2023-06-02 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/flvdec.c | 58 ++--
 1 file changed, 50 insertions(+), 8 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index d83edff727..c8e6cadf1c 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -79,6 +79,8 @@ typedef struct FLVContext {
 int64_t last_ts;
 int64_t time_offset;
 int64_t time_pos;
+
+uint8_t exheader;
 } FLVContext;
 
 /* AMF date type */
@@ -302,13 +304,25 @@ static void flv_set_audio_codec(AVFormatContext *s, 
AVStream *astream,
 }
 }
 
-static int flv_same_video_codec(AVCodecParameters *vpar, int flags)
+static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters *vpar, 
int flags)
 {
 int flv_codecid = flags & FLV_VIDEO_CODECID_MASK;
+FLVContext *flv = s->priv_data;
 
 if (!vpar->codec_id && !vpar->codec_tag)
 return 1;
 
+if (flv->exheader) {
+uint8_t *codec_id_str = (uint8_t *)s->pb->buf_ptr;
+uint32_t codec_id = codec_id_str[3] | codec_id_str[2] << 8 | 
codec_id_str[1] << 16 | codec_id_str[0] << 24;
+switch(codec_id) {
+case MKBETAG('h', 'v', 'c', '1'):
+return vpar->codec_id == AV_CODEC_ID_HEVC;
+default:
+break;
+}
+}
+
 switch (flv_codecid) {
 case FLV_CODECID_H263:
 return vpar->codec_id == AV_CODEC_ID_FLV1;
@@ -331,9 +345,24 @@ static int flv_set_video_codec(AVFormatContext *s, 
AVStream *vstream,
int flv_codecid, int read)
 {
 FFStream *const vstreami = ffstream(vstream);
+FLVContext *flv = s->priv_data;
 int ret = 0;
 AVCodecParameters *par = vstream->codecpar;
 enum AVCodecID old_codec_id = vstream->codecpar->codec_id;
+flv_codecid &= FLV_VIDEO_CODECID_MASK;
+
+if (flv->exheader) {
+uint32_t codec_id = avio_rb32(s->pb);
+
+switch(codec_id) {
+case MKBETAG('h', 'v', 'c', '1'):
+par->codec_id = AV_CODEC_ID_HEVC;
+vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
+return 4;
+default:
+break;
+}
+}
 switch (flv_codecid) {
 case FLV_CODECID_H263:
 par->codec_id = AV_CODEC_ID_FLV1;
@@ -796,6 +825,7 @@ static int flv_read_header(AVFormatContext *s)
 s->start_time = 0;
 flv->sum_flv_tag_size = 0;
 flv->last_keyframe_stream_index = -1;
+flv->exheader = 0;
 
 return 0;
 }
@@ -1071,6 +1101,11 @@ retry:
 } else if (type == FLV_TAG_TYPE_VIDEO) {
 stream_type = FLV_STREAM_TYPE_VIDEO;
 flags= avio_r8(s->pb);
+/*
+ * Reference Enhancing FLV 2023-03-v1.0.0-B.8
+ * 
https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
+ * */
+flv->exheader = (flags >> 7) & 1;
 size--;
 if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD)
 goto skip;
@@ -1129,7 +1164,7 @@ skip:
 break;
 } else if (stream_type == FLV_STREAM_TYPE_VIDEO) {
 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
-(s->video_codec_id || flv_same_video_codec(st->codecpar, 
flags)))
+(s->video_codec_id || flv_same_video_codec(s, st->codecpar, 
flags)))
 break;
 } else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) {
 if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
@@ -1230,7 +1265,7 @@ retry_duration:
 avcodec_parameters_free(&par);
 }
 } else if (stream_type == FLV_STREAM_TYPE_VIDEO) {
-int ret = flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 
1);
+int ret = flv_set_video_codec(s, st, flags, 1);
 if (ret < 0)
 return ret;
 size -= ret;
@@ -1242,16 +1277,23 @@ retry_duration:
 
 if (st->codecpar->codec_id == AV_CODEC_ID_AAC ||
 st->codecpar->codec_id == AV_CODEC_ID_H264 ||
-st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
-int type = avio_r8(s->pb);
-size--;
+st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
+st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
+int type = 0;
+if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) {
+type = flags & 0x0F;
+} else {
+type = avio_r8(s->pb);
+size--;
+}
 
 if (size < 0) {
 ret = AVERROR_INVALIDDATA;
 goto leave;
 }
 
-if (st->codecpar->codec_id == AV_CODEC_ID_H264 || 
st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
+if (st->codecpar->codec_id == AV_CODEC_ID_H264 || 
st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
+(st->codecpar->codec_id == AV_CODEC_ID_HEVC && type == 
PacketTypeCodedFrames)) {
 // sign extension
 int32_t cts = (avio_rb24(s->pb) + 0xff80) ^ 0xff80;
 pts = av_sat_add64(dts, ct

[FFmpeg-devel] [PATCH v11 4/6] avformat/flvdec: support demux av1 in enhanced flv

2023-06-02 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/flvdec.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index c8e6cadf1c..a0362ff11c 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -318,6 +318,8 @@ static int flv_same_video_codec(AVFormatContext *s, 
AVCodecParameters *vpar, int
 switch(codec_id) {
 case MKBETAG('h', 'v', 'c', '1'):
 return vpar->codec_id == AV_CODEC_ID_HEVC;
+case MKBETAG('a', 'v', '0', '1'):
+return vpar->codec_id == AV_CODEC_ID_AV1;
 default:
 break;
 }
@@ -359,6 +361,10 @@ static int flv_set_video_codec(AVFormatContext *s, 
AVStream *vstream,
 par->codec_id = AV_CODEC_ID_HEVC;
 vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
 return 4;
+case MKBETAG('a', 'v', '0', '1'):
+par->codec_id = AV_CODEC_ID_AV1;
+vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
+return 4;
 default:
 break;
 }
@@ -1278,7 +1284,8 @@ retry_duration:
 if (st->codecpar->codec_id == AV_CODEC_ID_AAC ||
 st->codecpar->codec_id == AV_CODEC_ID_H264 ||
 st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
-st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
+st->codecpar->codec_id == AV_CODEC_ID_HEVC ||
+st->codecpar->codec_id == AV_CODEC_ID_AV1) {
 int type = 0;
 if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) {
 type = flags & 0x0F;
@@ -1309,7 +1316,8 @@ retry_duration:
 }
 }
 if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id 
== AV_CODEC_ID_AAC ||
-st->codecpar->codec_id == AV_CODEC_ID_H264 || 
st->codecpar->codec_id == AV_CODEC_ID_HEVC)) {
+st->codecpar->codec_id == AV_CODEC_ID_H264 || 
st->codecpar->codec_id == AV_CODEC_ID_HEVC ||
+st->codecpar->codec_id == AV_CODEC_ID_AV1)) {
 AVDictionaryEntry *t;
 
 if (st->codecpar->extradata) {
-- 
2.40.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v11 5/6] avformat/flvenc: support mux vp9 in enhanced flv

2023-06-02 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/Makefile |  2 +-
 libavformat/flvenc.c | 22 ++
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index c868e1626c..16cfe107ea 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+= flacenc.o 
flacenc_header.o \
 OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
 OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
 OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
-OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o
+OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o vpcc.o
 OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
 OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
 OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 99fa1bd723..335d900415 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -29,6 +29,7 @@
 #include "avio.h"
 #include "avc.h"
 #include "av1.h"
+#include "vpcc.h"
 #include "hevc.h"
 #include "avformat.h"
 #include "flv.h"
@@ -50,6 +51,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
 { AV_CODEC_ID_H264, FLV_CODECID_H264 },
 { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
 { AV_CODEC_ID_AV1,  MKBETAG('a', 'v', '0', '1') },
+{ AV_CODEC_ID_VP9,  MKBETAG('v', 'p', '0', '9') },
 { AV_CODEC_ID_NONE, 0 }
 };
 
@@ -494,7 +496,7 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par, i
 
 if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
AV_CODEC_ID_HEVC
-|| par->codec_id == AV_CODEC_ID_AV1) {
+|| par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == 
AV_CODEC_ID_VP9) {
 int64_t pos;
 avio_w8(pb,
 par->codec_type == AVMEDIA_TYPE_VIDEO ?
@@ -540,9 +542,9 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par, i
 if (par->codec_id == AV_CODEC_ID_HEVC) {
 avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart | 
FLV_FRAME_KEY); // ExVideoTagHeader mode with PacketTypeSequenceStart
 avio_write(pb, "hvc1", 4);
-} else if (par->codec_id == AV_CODEC_ID_AV1) {
+} else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == 
AV_CODEC_ID_VP9) {
 avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart | 
FLV_FRAME_KEY);
-avio_write(pb, "av01", 4);
+avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : 
"vp09", 4);
 } else {
 avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
 avio_w8(pb, 0); // AVC sequence header
@@ -553,6 +555,8 @@ static void flv_write_codec_header(AVFormatContext* s, 
AVCodecParameters* par, i
 ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0);
 else if (par->codec_id == AV_CODEC_ID_AV1)
 ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 1);
+else if (par->codec_id == AV_CODEC_ID_VP9)
+ff_isom_write_vpcc(s, pb, par->extradata, par->extradata_size, 
par);
 else
 ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
 }
@@ -853,14 +857,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 par->codec_id == AV_CODEC_ID_VP6  || par->codec_id == AV_CODEC_ID_AAC)
 flags_size = 2;
 else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
AV_CODEC_ID_MPEG4 ||
- par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == 
AV_CODEC_ID_AV1)
+ par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == 
AV_CODEC_ID_AV1 ||
+ par->codec_id == AV_CODEC_ID_VP9)
 flags_size = 5;
 else
 flags_size = 1;
 
 if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
 || par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
AV_CODEC_ID_HEVC
-|| par->codec_id == AV_CODEC_ID_AV1) {
+|| par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == 
AV_CODEC_ID_VP9) {
 size_t side_size;
 uint8_t *side = av_packet_get_side_data(pkt, 
AV_PKT_DATA_NEW_EXTRADATA, &side_size);
 if (side && side_size > 0 && (side_size != par->extradata_size || 
memcmp(side, par->extradata, side_size))) {
@@ -881,7 +886,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 return AVERROR(EINVAL);
 }
 if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
AV_CODEC_ID_MPEG4 ||
-par->codec_id == AV_CODEC_ID_HEVC ||  par->codec_id == 
AV_CODEC_ID_AV1) {
+par->codec_id == AV_CODEC_ID_HEVC ||  par->codec_id == AV_CODEC_ID_AV1 
||
+  

[FFmpeg-devel] [PATCH v11 6/6] avformat/flvdec: support demux vp9 in enhanced flv

2023-06-02 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavformat/flvdec.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index a0362ff11c..a6a94a4021 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -320,6 +320,8 @@ static int flv_same_video_codec(AVFormatContext *s, 
AVCodecParameters *vpar, int
 return vpar->codec_id == AV_CODEC_ID_HEVC;
 case MKBETAG('a', 'v', '0', '1'):
 return vpar->codec_id == AV_CODEC_ID_AV1;
+case MKBETAG('v', 'p', '0', '9'):
+return vpar->codec_id == AV_CODEC_ID_VP9;
 default:
 break;
 }
@@ -365,6 +367,10 @@ static int flv_set_video_codec(AVFormatContext *s, 
AVStream *vstream,
 par->codec_id = AV_CODEC_ID_AV1;
 vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
 return 4;
+case MKBETAG('v', 'p', '0', '9'):
+par->codec_id = AV_CODEC_ID_VP9;
+vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
+return 4;
 default:
 break;
 }
@@ -1285,7 +1291,8 @@ retry_duration:
 st->codecpar->codec_id == AV_CODEC_ID_H264 ||
 st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
 st->codecpar->codec_id == AV_CODEC_ID_HEVC ||
-st->codecpar->codec_id == AV_CODEC_ID_AV1) {
+st->codecpar->codec_id == AV_CODEC_ID_AV1 ||
+st->codecpar->codec_id == AV_CODEC_ID_VP9) {
 int type = 0;
 if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) {
 type = flags & 0x0F;
@@ -1317,7 +1324,7 @@ retry_duration:
 }
 if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id 
== AV_CODEC_ID_AAC ||
 st->codecpar->codec_id == AV_CODEC_ID_H264 || 
st->codecpar->codec_id == AV_CODEC_ID_HEVC ||
-st->codecpar->codec_id == AV_CODEC_ID_AV1)) {
+st->codecpar->codec_id == AV_CODEC_ID_AV1 || 
st->codecpar->codec_id == AV_CODEC_ID_VP9)) {
 AVDictionaryEntry *t;
 
 if (st->codecpar->extradata) {
-- 
2.40.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v1] avformat/ivfenc: Set the "number of frames" in IVF header

2023-06-02 Thread Dai, Jianhui J
Should set "number of frames" to bytes 24-27 of IVF header, not duration.
It is described by [1]. Also confirm it by parsing IVF files in [2].

[1] Duck IVF - MultimediaWiki
https://wiki.multimedia.cx/index.php/Duck_IVF

[2] webm/vp8-test-vectors - Git at Google
https://chromium.googlesource.com/webm/vp8-test-vectors

Signed-off-by: Jianhui Dai 
---
 libavformat/ivfenc.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index 47b4efbcd1..88399099d4 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -72,7 +72,8 @@ static int ivf_write_header(AVFormatContext *s)
 avio_wl16(pb, par->height);
 avio_wl32(pb, s->streams[0]->time_base.den);
 avio_wl32(pb, s->streams[0]->time_base.num);
-avio_wl64(pb, 0xULL); // length is overwritten at the end 
of muxing
+avio_wl32(pb, 0x); // "number of frames" is overwritten at the end 
of muxing
+avio_wl32(pb, 0); // unused
 
 return 0;
 }
@@ -99,16 +100,12 @@ static int ivf_write_trailer(AVFormatContext *s)
 AVIOContext *pb = s->pb;
 IVFEncContext *ctx = s->priv_data;
 
-if ((pb->seekable & AVIO_SEEKABLE_NORMAL) &&
-(ctx->frame_cnt > 1 || (ctx->frame_cnt == 1 && 
ctx->last_pkt_duration))) {
+// overwrite the "number of frames"
+if ((pb->seekable & AVIO_SEEKABLE_NORMAL)) {
 int64_t end = avio_tell(pb);
 
 avio_seek(pb, 24, SEEK_SET);
-// overwrite the "length" field (duration)
-avio_wl32(pb, ctx->last_pkt_duration ?
-  ctx->sum_delta_pts + ctx->last_pkt_duration :
-  ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 1));
-avio_wl32(pb, 0); // zero out unused bytes
+avio_wl32(pb, ctx->frame_cnt);
 avio_seek(pb, end, SEEK_SET);
 }
 
-- 
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] [PATCH v3 1/9] libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12

2023-06-02 Thread Tong Wu
From: Wu Jianhua 

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 configure  |   5 +
 doc/APIchanges |   7 +
 libavutil/Makefile |   3 +
 libavutil/hwcontext.c  |   4 +
 libavutil/hwcontext.h  |   1 +
 libavutil/hwcontext_d3d12va.c  | 699 +
 libavutil/hwcontext_d3d12va.h  | 167 ++
 libavutil/hwcontext_d3d12va_internal.h |  63 +++
 libavutil/hwcontext_internal.h |   1 +
 libavutil/pixdesc.c|   4 +
 libavutil/pixfmt.h |   9 +
 libavutil/tests/hwdevice.c |   2 +
 12 files changed, 965 insertions(+)
 create mode 100644 libavutil/hwcontext_d3d12va.c
 create mode 100644 libavutil/hwcontext_d3d12va.h
 create mode 100644 libavutil/hwcontext_d3d12va_internal.h

diff --git a/configure b/configure
index 495493aa0e..b86064e36f 100755
--- a/configure
+++ b/configure
@@ -337,6 +337,7 @@ External library support:
   --disable-cuda-llvm  disable CUDA compilation using clang [autodetect]
   --disable-cuvid  disable Nvidia CUVID support [autodetect]
   --disable-d3d11vadisable Microsoft Direct3D 11 video acceleration 
code [autodetect]
+  --disable-d3d12vadisable Microsoft Direct3D 12 video acceleration 
code [autodetect]
   --disable-dxva2  disable Microsoft DirectX 9 video acceleration code 
[autodetect]
   --disable-ffnvcodec  disable dynamically linked Nvidia code [autodetect]
   --enable-libdrm  enable DRM code (Linux) [no]
@@ -1885,6 +1886,7 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
 cuda_llvm
 cuvid
 d3d11va
+d3d12va
 dxva2
 ffnvcodec
 nvdec
@@ -2999,6 +3001,7 @@ crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
 cuda_deps="ffnvcodec"
 cuvid_deps="ffnvcodec"
 d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
+d3d12va_deps="dxva_h ID3D12Device ID3D12VideoDecoder"
 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
 ffnvcodec_deps_any="libdl LoadLibrary"
 mediacodec_deps="android"
@@ -6449,6 +6452,8 @@ check_type "windows.h dxgi1_2.h" "IDXGIOutput1"
 check_type "windows.h dxgi1_5.h" "IDXGIOutput5"
 check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
 check_type "windows.h d3d11.h" "ID3D11VideoContext"
+check_type "windows.h d3d12.h" "ID3D12Device"
+check_type "windows.h d3d12video.h" "ID3D12VideoDecoder"
 check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00
 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
 check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
diff --git a/doc/APIchanges b/doc/APIchanges
index f040211f7d..b64ed73a64 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,13 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2023-05-xx - xx - lavu 58.7.100 - pixfmt.h hwcontext.h 
hwcontext_d3d12va.h
+  Add AV_HWDEVICE_TYPE_D3D12VA and AV_PIX_FMT_D3D12.
+  Add AVD3D12VADeviceContext, AVD3D12VASyncContext, AVD3D12FrameDescriptor,
+  and AVD3D12VAFramesContext.
+  Add av_d3d12va_map_sw_to_hw_format, av_d3d12va_create_sync_context,
+  av_d3d12va_release_sync_context, av_d3d12va_wait_idle, and 
av_d3d12va_wait_queue_idle.
+
 2023-05-29 - xx - lavc 60.16.100 - avcodec.h codec_id.h
   Add AV_CODEC_ID_EVC, FF_PROFILE_EVC_BASELINE, and FF_PROFILE_EVC_MAIN.
 
diff --git a/libavutil/Makefile b/libavutil/Makefile
index bd9c6f9e32..40d49d76dd 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -41,6 +41,7 @@ HEADERS = adler32.h   
  \
   hwcontext.h   \
   hwcontext_cuda.h  \
   hwcontext_d3d11va.h   \
+  hwcontext_d3d12va.h   \
   hwcontext_drm.h   \
   hwcontext_dxva2.h \
   hwcontext_qsv.h   \
@@ -186,6 +187,7 @@ OBJS = adler32.o
\
 
 OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
 OBJS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.o
+OBJS-$(CONFIG_D3D12VA)  += hwcontext_d3d12va.o
 OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o
 OBJS-$(CONFIG_LIBDRM)   += hwcontext_drm.o
 OBJS-$(CONFIG_MACOS_KPERF)  += macos_kperf.o
@@ -209,6 +211,7 @@ SKIPHEADERS-$(HAVE_CUDA_H) += hwcontext_cuda.h
 SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda_internal.h \
   cuda_check.h
 SKIPHEADERS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.h
+SKIPHEADERS-$(CONFIG_D3D12VA)  += hwcontext_d3d12v

[FFmpeg-devel] [PATCH v3 2/9] avcodec: add D3D12VA hardware accelerated H264 decoding

2023-06-02 Thread Tong Wu
From: Wu Jianhua 

The implementation is based on:
https://learn.microsoft.com/en-us/windows/win32/medfound/direct3d-12-video-overview

With the Direct3D 12 video decoding support, we can render or process
the decoded images by the pixel shaders or compute shaders directly
without the extra copy overhead, which is beneficial especially if you
are trying to render or post-process a 4K or 8K video.

The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 configure   |   2 +
 libavcodec/Makefile |   3 +
 libavcodec/d3d11va.h|   3 -
 libavcodec/d3d12va.c| 552 
 libavcodec/d3d12va.h| 184 
 libavcodec/d3d12va_h264.c   | 210 ++
 libavcodec/dxva2.c  |  24 ++
 libavcodec/dxva2.h  |   3 -
 libavcodec/dxva2_h264.c |  12 +-
 libavcodec/dxva2_internal.h |  67 +++--
 libavcodec/h264_slice.c |   4 +
 libavcodec/h264dec.c|   3 +
 libavcodec/hwaccels.h   |   1 +
 libavcodec/hwconfig.h   |   2 +
 14 files changed, 1028 insertions(+), 42 deletions(-)
 create mode 100644 libavcodec/d3d12va.c
 create mode 100644 libavcodec/d3d12va.h
 create mode 100644 libavcodec/d3d12va_h264.c

diff --git a/configure b/configure
index b86064e36f..f5dad4653f 100755
--- a/configure
+++ b/configure
@@ -3033,6 +3033,8 @@ h264_d3d11va_hwaccel_deps="d3d11va"
 h264_d3d11va_hwaccel_select="h264_decoder"
 h264_d3d11va2_hwaccel_deps="d3d11va"
 h264_d3d11va2_hwaccel_select="h264_decoder"
+h264_d3d12va_hwaccel_deps="d3d12va"
+h264_d3d12va_hwaccel_select="h264_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
 h264_dxva2_hwaccel_select="h264_decoder"
 h264_nvdec_hwaccel_deps="nvdec"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9aacc1d477..ae143d8821 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -977,6 +977,7 @@ OBJS-$(CONFIG_ADPCM_ZORK_DECODER) += adpcm.o 
adpcm_data.o
 
 # hardware accelerators
 OBJS-$(CONFIG_D3D11VA)+= dxva2.o
+OBJS-$(CONFIG_D3D12VA)+= dxva2.o d3d12va.o
 OBJS-$(CONFIG_DXVA2)  += dxva2.o
 OBJS-$(CONFIG_NVDEC)  += nvdec.o
 OBJS-$(CONFIG_VAAPI)  += vaapi_decode.o
@@ -994,6 +995,7 @@ OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
 OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL)  += videotoolbox.o
 OBJS-$(CONFIG_H264_D3D11VA_HWACCEL)   += dxva2_h264.o
 OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o
+OBJS-$(CONFIG_H264_D3D12VA_HWACCEL)   += dxva2_h264.o d3d12va_h264.o
 OBJS-$(CONFIG_H264_NVDEC_HWACCEL) += nvdec_h264.o
 OBJS-$(CONFIG_H264_QSV_HWACCEL)   += qsvdec.o
 OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
@@ -1277,6 +1279,7 @@ SKIPHEADERS+= %_tablegen.h
  \
 
 SKIPHEADERS-$(CONFIG_AMF)  += amfenc.h
 SKIPHEADERS-$(CONFIG_D3D11VA)  += d3d11va.h dxva2_internal.h
+SKIPHEADERS-$(CONFIG_D3D12VA)  += d3d12va.h
 SKIPHEADERS-$(CONFIG_DXVA2)+= dxva2.h dxva2_internal.h
 SKIPHEADERS-$(CONFIG_JNI)  += ffjni.h
 SKIPHEADERS-$(CONFIG_LCMS2)+= fflcms2.h
diff --git a/libavcodec/d3d11va.h b/libavcodec/d3d11va.h
index 6816b6c1e6..27f40e5519 100644
--- a/libavcodec/d3d11va.h
+++ b/libavcodec/d3d11va.h
@@ -45,9 +45,6 @@
  * @{
  */
 
-#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for 
Direct3D11 and old UVD/UVD+ ATI video cards
-#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO2 ///< Work around for 
Direct3D11 and old Intel GPUs with ClearVideo interface
-
 /**
  * This structure is used to provides the necessary configurations and data
  * to the Direct3D11 FFmpeg HWAccel implementation.
diff --git a/libavcodec/d3d12va.c b/libavcodec/d3d12va.c
new file mode 100644
index 00..7f1fab7251
--- /dev/null
+++ b/libavcodec/d3d12va.c
@@ -0,0 +1,552 @@
+/*
+ * Direct3D 12 HW acceleration video decoder
+ *
+ * copyright (c) 2022-2023 Wu Jianhua 
+ *
+ * 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 
+#include 
+#include 
+
+#include "libavutil/common.h"
+#include "libavutil/log.h"
+#include "li

[FFmpeg-devel] [PATCH v3 3/9] avcodec: add D3D12VA hardware accelerated HEVC decoding

2023-06-02 Thread Tong Wu
From: Wu Jianhua 

The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 configure   |   2 +
 libavcodec/Makefile |   1 +
 libavcodec/d3d12va_hevc.c   | 211 
 libavcodec/dxva2_hevc.c |  10 +-
 libavcodec/dxva2_internal.h |   4 +
 libavcodec/hevcdec.c|  10 ++
 libavcodec/hwaccels.h   |   1 +
 7 files changed, 235 insertions(+), 4 deletions(-)
 create mode 100644 libavcodec/d3d12va_hevc.c

diff --git a/configure b/configure
index f5dad4653f..3d25e5fdea 100755
--- a/configure
+++ b/configure
@@ -3051,6 +3051,8 @@ hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
 hevc_d3d11va_hwaccel_select="hevc_decoder"
 hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
 hevc_d3d11va2_hwaccel_select="hevc_decoder"
+hevc_d3d12va_hwaccel_deps="d3d12va DXVA_PicParams_HEVC"
+hevc_d3d12va_hwaccel_select="hevc_decoder"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
 hevc_dxva2_hwaccel_select="hevc_decoder"
 hevc_nvdec_hwaccel_deps="nvdec"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ae143d8821..6cc28f2fd0 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1004,6 +1004,7 @@ OBJS-$(CONFIG_H264_VIDEOTOOLBOX_HWACCEL)  += 
videotoolbox.o
 OBJS-$(CONFIG_H264_VULKAN_HWACCEL)+= vulkan_decode.o vulkan_h264.o
 OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL)   += dxva2_hevc.o
 OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o
+OBJS-$(CONFIG_HEVC_D3D12VA_HWACCEL)   += dxva2_hevc.o d3d12va_hevc.o
 OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o
 OBJS-$(CONFIG_HEVC_QSV_HWACCEL)   += qsvdec.o
 OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o
diff --git a/libavcodec/d3d12va_hevc.c b/libavcodec/d3d12va_hevc.c
new file mode 100644
index 00..1d94831e01
--- /dev/null
+++ b/libavcodec/d3d12va_hevc.c
@@ -0,0 +1,211 @@
+/*
+ * Direct3D 12 HEVC HW acceleration
+ *
+ * copyright (c) 2022-2023 Wu Jianhua 
+ *
+ * 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 "config_components.h"
+
+#include "libavutil/avassert.h"
+#include "libavutil/hwcontext_d3d12va_internal.h"
+#include "hevc_data.h"
+#include "hevcdec.h"
+#include "dxva2_internal.h"
+#include "d3d12va.h"
+#include 
+
+#define MAX_SLICES 256
+
+typedef struct HEVCDecodePictureContext {
+DXVA_PicParams_HEVCpp;
+DXVA_Qmatrix_HEVC  qm;
+unsigned   slice_count;
+DXVA_Slice_HEVC_Short  slice_short[MAX_SLICES];
+const uint8_t *bitstream;
+unsigned   bitstream_size;
+} HEVCDecodePictureContext;
+
+static void fill_slice_short(DXVA_Slice_HEVC_Short *slice, unsigned position, 
unsigned size)
+{
+memset(slice, 0, sizeof(*slice));
+slice->BSNALunitDataLocation = position;
+slice->SliceBytesInBuffer= size;
+slice->wBadSliceChopping = 0;
+}
+
+static int d3d12va_hevc_start_frame(AVCodecContext *avctx, av_unused const 
uint8_t *buffer, av_unused uint32_t size)
+{
+const HEVCContext*h   = avctx->priv_data;
+D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx);
+HEVCDecodePictureContext *ctx_pic = h->ref->hwaccel_picture_private;
+
+if (!ctx)
+return -1;
+
+av_assert0(ctx_pic);
+
+ff_dxva2_hevc_fill_picture_parameters(avctx, (AVDXVAContext *)ctx, 
&ctx_pic->pp);
+
+ff_dxva2_hevc_fill_scaling_lists(avctx, (AVDXVAContext *)ctx, 
&ctx_pic->qm);
+
+ctx_pic->slice_count= 0;
+ctx_pic->bitstream_size = 0;
+ctx_pic->bitstream  = NULL;
+
+return 0;
+}
+
+static int d3d12va_hevc_decode_slice(AVCodecContext *avctx, const uint8_t 
*buffer, uint32_t size)
+{
+const HEVCContext*h   = avctx->priv_data;
+const HEVCFrame  *current_picture = h->ref;
+HEVCDecodePictureContext *ctx_pic = 
current_picture->hwaccel_picture_private;
+unsigned position;
+
+if (ctx_pic->slice_count >= MAX_SLICES)
+return AVERROR(ERANGE);
+
+if (!ctx_pic->bitstream)
+ctx_pic->bitstream = buffer;
+ctx_pic->bitstream_size += size;
+
+position = buffer - ctx_pic->bitstream;
+fill_slice_short(&ctx_pic->

[FFmpeg-devel] [PATCH v3 4/9] avcodec: add D3D12VA hardware accelerated VP9 decoding

2023-06-02 Thread Tong Wu
From: Wu Jianhua 

The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 configure   |   2 +
 libavcodec/Makefile |   1 +
 libavcodec/d3d12va_vp9.c| 176 
 libavcodec/dxva2_internal.h |   2 +
 libavcodec/dxva2_vp9.c  |   7 +-
 libavcodec/hwaccels.h   |   1 +
 libavcodec/vp9.c|   7 ++
 7 files changed, 193 insertions(+), 3 deletions(-)
 create mode 100644 libavcodec/d3d12va_vp9.c

diff --git a/configure b/configure
index 3d25e5fdea..fa2548f3e2 100755
--- a/configure
+++ b/configure
@@ -3119,6 +3119,8 @@ vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va_hwaccel_select="vp9_decoder"
 vp9_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
 vp9_d3d11va2_hwaccel_select="vp9_decoder"
+vp9_d3d12va_hwaccel_deps="d3d12va DXVA_PicParams_VP9"
+vp9_d3d12va_hwaccel_select="vp9_decoder"
 vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
 vp9_dxva2_hwaccel_select="vp9_decoder"
 vp9_nvdec_hwaccel_deps="nvdec"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6cc28f2fd0..d5a1bfef7a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1036,6 +1036,7 @@ OBJS-$(CONFIG_VP8_NVDEC_HWACCEL)  += nvdec_vp8.o
 OBJS-$(CONFIG_VP8_VAAPI_HWACCEL)  += vaapi_vp8.o
 OBJS-$(CONFIG_VP9_D3D11VA_HWACCEL)+= dxva2_vp9.o
 OBJS-$(CONFIG_VP9_DXVA2_HWACCEL)  += dxva2_vp9.o
+OBJS-$(CONFIG_VP9_D3D12VA_HWACCEL)+= dxva2_vp9.o d3d12va_vp9.o
 OBJS-$(CONFIG_VP9_NVDEC_HWACCEL)  += nvdec_vp9.o
 OBJS-$(CONFIG_VP9_VAAPI_HWACCEL)  += vaapi_vp9.o
 OBJS-$(CONFIG_VP9_VDPAU_HWACCEL)  += vdpau_vp9.o
diff --git a/libavcodec/d3d12va_vp9.c b/libavcodec/d3d12va_vp9.c
new file mode 100644
index 00..dc1c461f5c
--- /dev/null
+++ b/libavcodec/d3d12va_vp9.c
@@ -0,0 +1,176 @@
+/*
+ * Direct3D 12 VP9 HW acceleration
+ *
+ * copyright (c) 2022-2023 Wu Jianhua 
+ *
+ * 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 "config_components.h"
+
+#include "libavutil/avassert.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/hwcontext_d3d12va_internal.h"
+
+#include "vp9shared.h"
+#include "dxva2_internal.h"
+#include "d3d12va.h"
+
+typedef struct VP9DecodePictureContext {
+DXVA_PicParams_VP9pp;
+DXVA_Slice_VPx_Short  slice;
+const uint8_t*bitstream;
+unsigned  bitstream_size;
+} VP9DecodePictureContext;
+
+static void fill_slice_short(DXVA_Slice_VPx_Short *slice, unsigned position, 
unsigned size)
+{
+memset(slice, 0, sizeof(*slice));
+slice->BSNALunitDataLocation = position;
+slice->SliceBytesInBuffer= size;
+slice->wBadSliceChopping = 0;
+}
+
+static int d3d12va_vp9_start_frame(AVCodecContext *avctx, av_unused const 
uint8_t *buffer, av_unused uint32_t size)
+{
+const VP9SharedContext  *h   = avctx->priv_data;
+D3D12VADecodeContext *ctx = D3D12VA_DECODE_CONTEXT(avctx);
+VP9DecodePictureContext *ctx_pic = 
h->frames[CUR_FRAME].hwaccel_picture_private;
+
+if (!ctx)
+return -1;
+
+av_assert0(ctx_pic);
+
+if (ff_dxva2_vp9_fill_picture_parameters(avctx, (AVDXVAContext *)ctx, 
&ctx_pic->pp) < 0)
+return -1;
+
+ctx_pic->bitstream_size = 0;
+ctx_pic->bitstream = NULL;
+
+return 0;
+}
+
+static int d3d12va_vp9_decode_slice(AVCodecContext *avctx, const uint8_t 
*buffer, uint32_t size)
+{
+const VP9SharedContext  *h   = avctx->priv_data;
+VP9DecodePictureContext *ctx_pic = 
h->frames[CUR_FRAME].hwaccel_picture_private;
+unsigned position;
+
+if (!ctx_pic->bitstream)
+ctx_pic->bitstream = buffer;
+ctx_pic->bitstream_size += size;
+
+position = buffer - ctx_pic->bitstream;
+fill_slice_short(&ctx_pic->slice, position, size);
+
+return 0;
+}
+
+static int update_input_arguments(AVCodecContext *avctx, 
D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *input_args, ID3D12Resource *buffer)
+{
+D3D12VADecodeContext   *ctx  = D3D12VA_DECODE_CONTEXT(avctx);
+AVHWFramesContext  *frames_ctx   = D3D12VA_FRAMES_CONTEXT(avctx);
+AVD3D12VAFramesContext *frames_hwctx = frames_ctx->hwctx;
+
+const VP9SharedContext

[FFmpeg-devel] [PATCH v3 5/9] avcodec: add D3D12VA hardware accelerated AV1 decoding

2023-06-02 Thread Tong Wu
From: Wu Jianhua 

The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 configure   |   2 +
 libavcodec/Makefile |   1 +
 libavcodec/av1dec.c |  10 ++
 libavcodec/d3d12va_av1.c| 220 
 libavcodec/dxva2_av1.c  |   5 +-
 libavcodec/dxva2_internal.h |   4 +
 libavcodec/hwaccels.h   |   1 +
 7 files changed, 241 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/d3d12va_av1.c

diff --git a/configure b/configure
index fa2548f3e2..1d05c898fb 100755
--- a/configure
+++ b/configure
@@ -3015,6 +3015,8 @@ av1_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_AV1"
 av1_d3d11va_hwaccel_select="av1_decoder"
 av1_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_AV1"
 av1_d3d11va2_hwaccel_select="av1_decoder"
+av1_d3d12va_hwaccel_deps="d3d12va DXVA_PicParams_AV1"
+av1_d3d12va_hwaccel_select="av1_decoder"
 av1_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_AV1"
 av1_dxva2_hwaccel_select="av1_decoder"
 av1_nvdec_hwaccel_deps="nvdec CUVIDAV1PICPARAMS"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index d5a1bfef7a..d2940aad4c 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -987,6 +987,7 @@ OBJS-$(CONFIG_VULKAN) += vulkan.o 
vulkan_video.o
 
 OBJS-$(CONFIG_AV1_D3D11VA_HWACCEL)+= dxva2_av1.o
 OBJS-$(CONFIG_AV1_DXVA2_HWACCEL)  += dxva2_av1.o
+OBJS-$(CONFIG_AV1_D3D12VA_HWACCEL)+= dxva2_av1.o d3d12va_av1.o
 OBJS-$(CONFIG_AV1_NVDEC_HWACCEL)  += nvdec_av1.o
 OBJS-$(CONFIG_AV1_VAAPI_HWACCEL)  += vaapi_av1.o
 OBJS-$(CONFIG_AV1_VDPAU_HWACCEL)  += vdpau_av1.o
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 5cc5d87c64..bbf13d4717 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -448,6 +448,7 @@ static int get_pixel_format(AVCodecContext *avctx)
 enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
 #define HWACCEL_MAX (CONFIG_AV1_DXVA2_HWACCEL + \
  CONFIG_AV1_D3D11VA_HWACCEL * 2 + \
+ CONFIG_AV1_D3D12VA_HWACCEL + \
  CONFIG_AV1_NVDEC_HWACCEL + \
  CONFIG_AV1_VAAPI_HWACCEL + \
  CONFIG_AV1_VDPAU_HWACCEL + \
@@ -523,6 +524,9 @@ static int get_pixel_format(AVCodecContext *avctx)
 *fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
 *fmtp++ = AV_PIX_FMT_D3D11;
 #endif
+#if CONFIG_AV1_D3D12VA_HWACCEL
+*fmtp++ = AV_PIX_FMT_D3D12;
+#endif
 #if CONFIG_AV1_NVDEC_HWACCEL
 *fmtp++ = AV_PIX_FMT_CUDA;
 #endif
@@ -544,6 +548,9 @@ static int get_pixel_format(AVCodecContext *avctx)
 *fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
 *fmtp++ = AV_PIX_FMT_D3D11;
 #endif
+#if CONFIG_AV1_D3D12VA_HWACCEL
+*fmtp++ = AV_PIX_FMT_D3D12;
+#endif
 #if CONFIG_AV1_NVDEC_HWACCEL
 *fmtp++ = AV_PIX_FMT_CUDA;
 #endif
@@ -1541,6 +1548,9 @@ const FFCodec ff_av1_decoder = {
 #if CONFIG_AV1_D3D11VA2_HWACCEL
 HWACCEL_D3D11VA2(av1),
 #endif
+#if CONFIG_AV1_D3D12VA_HWACCEL
+HWACCEL_D3D12VA(av1),
+#endif
 #if CONFIG_AV1_NVDEC_HWACCEL
 HWACCEL_NVDEC(av1),
 #endif
diff --git a/libavcodec/d3d12va_av1.c b/libavcodec/d3d12va_av1.c
new file mode 100644
index 00..44ae689341
--- /dev/null
+++ b/libavcodec/d3d12va_av1.c
@@ -0,0 +1,220 @@
+/*
+ * Direct3D 12 AV1 HW acceleration
+ *
+ * copyright (c) 2022-2023 Wu Jianhua 
+ *
+ * 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 "config_components.h"
+#include "libavutil/avassert.h"
+#include "libavutil/hwcontext_d3d12va_internal.h"
+#include "av1dec.h"
+#include "dxva2_internal.h"
+#include "d3d12va.h"
+
+#define MAX_TILES 256
+
+typedef struct D3D12AV1DecodeContext {
+D3D12VADecodeContext ctx;
+uint8_t *bitstream_buffer;
+} D3D12AV1DecodeContext;
+
+#define D3D12_AV1_DECODE_CONTEXT(avctx) ((D3D12AV1DecodeContext 
*)D3D12VA_DECODE_CONTEXT(avctx))
+
+typedef struct AV1DecodePictureContext {
+DXVA_PicParams_AV1  pp;
+unsignedtile_count;
+DXVA_Tile_AV1   tiles[MAX_TILES];
+uint8_t*bitstream;
+unsignedbitstream_size;
+} AV1DecodePictureContext;
+
+static int d3d12va_av1_start_frame(AVCodecContext *avctx, av_unused 

[FFmpeg-devel] [PATCH v3 6/9] avcodec: add D3D12VA hardware accelerated MPEG-2 decoding

2023-06-02 Thread Tong Wu
From: Wu Jianhua 

The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 configure   |   2 +
 libavcodec/Makefile |   1 +
 libavcodec/d3d12va_mpeg2.c  | 191 
 libavcodec/dxva2_internal.h |   6 ++
 libavcodec/dxva2_mpeg2.c|  18 ++--
 libavcodec/hwaccels.h   |   1 +
 libavcodec/mpeg12dec.c  |   6 ++
 7 files changed, 216 insertions(+), 9 deletions(-)
 create mode 100644 libavcodec/d3d12va_mpeg2.c

diff --git a/configure b/configure
index 1d05c898fb..9f8c535f5c 100755
--- a/configure
+++ b/configure
@@ -3081,6 +3081,8 @@ mpeg2_d3d11va_hwaccel_deps="d3d11va"
 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
 mpeg2_d3d11va2_hwaccel_deps="d3d11va"
 mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
+mpeg2_d3d12va_hwaccel_deps="d3d12va"
+mpeg2_d3d12va_hwaccel_select="mpeg2video_decoder"
 mpeg2_dxva2_hwaccel_deps="dxva2"
 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
 mpeg2_nvdec_hwaccel_deps="nvdec"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index d2940aad4c..98d4ff814d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1018,6 +1018,7 @@ OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)+= 
vdpau_mpeg12.o
 OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
 OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL)  += dxva2_mpeg2.o
 OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL)+= dxva2_mpeg2.o
+OBJS-$(CONFIG_MPEG2_D3D12VA_HWACCEL)  += dxva2_mpeg2.o d3d12va_mpeg2.o
 OBJS-$(CONFIG_MPEG2_NVDEC_HWACCEL)+= nvdec_mpeg12.o
 OBJS-$(CONFIG_MPEG2_QSV_HWACCEL)  += qsvdec.o
 OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL)+= vaapi_mpeg2.o
diff --git a/libavcodec/d3d12va_mpeg2.c b/libavcodec/d3d12va_mpeg2.c
new file mode 100644
index 00..3f93a417c6
--- /dev/null
+++ b/libavcodec/d3d12va_mpeg2.c
@@ -0,0 +1,191 @@
+/*
+ * Direct3D12 MPEG-2 HW acceleration
+ *
+ * copyright (c) 2022-2023 Wu Jianhua 
+ *
+ * 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 "config_components.h"
+#include "libavutil/avassert.h"
+#include "libavutil/hwcontext_d3d12va_internal.h"
+#include "mpegutils.h"
+#include "mpegvideodec.h"
+#include "d3d12va.h"
+#include "dxva2_internal.h"
+
+#define MAX_SLICES  1024
+#define INVALID_REF 0x
+
+#define REF_RESOURCE(index) if (index != INVALID_REF) { \
+ctx->ref_resources[index] = frames_hwctx->texture_infos[index].texture; \
+}
+
+typedef struct D3D12DecodePictureContext {
+DXVA_PictureParameters  pp;
+DXVA_QmatrixDataqm;
+unsignedslice_count;
+DXVA_SliceInfo  slices[MAX_SLICES];
+const uint8_t  *bitstream;
+unsignedbitstream_size;
+} D3D12DecodePictureContext;
+
+static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const 
uint8_t *buffer,  av_unused uint32_t size)
+{
+const MpegEncContext  *s   = avctx->priv_data;
+D3D12VADecodeContext  *ctx = D3D12VA_DECODE_CONTEXT(avctx);
+D3D12DecodePictureContext *ctx_pic = 
s->current_picture_ptr->hwaccel_picture_private;
+DXVA_QmatrixData  *qm  = &ctx_pic->qm;
+
+if (!ctx)
+return -1;
+
+av_assert0(ctx_pic);
+
+ff_dxva2_mpeg2_fill_picture_parameters(avctx, (AVDXVAContext *)ctx, 
&ctx_pic->pp);
+ff_dxva2_mpeg2_fill_quantization_matrices(avctx, (AVDXVAContext *)ctx, 
&ctx_pic->qm);
+
+// Post processing operations are not supported in D3D12 Video
+ctx_pic->pp.wDeblockedPictureIndex = INVALID_REF;
+
+ctx_pic->bitstream  = NULL;
+ctx_pic->bitstream_size = 0;
+ctx_pic->slice_count= 0;
+
+return 0;
+}
+
+static int d3d12va_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t 
*buffer, uint32_t size)
+{
+const MpegEncContext  *s   = avctx->priv_data;
+D3D12DecodePictureContext *ctx_pic = 
s->current_picture_ptr->hwaccel_picture_private;
+
+int is_field = s->picture_structure != PICT_FRAME;
+
+if (ctx_pic->slice_count >= MAX_SLICES) {
+return AVERROR(ERANGE);
+}
+
+if (!ctx_pic->bitstream)
+ctx_pic->bitstream = buffer;
+ctx_pic->bitstream_size += size;
+
+ff_dxva2_mpeg2_fill_slice(avctx, &ctx_pic->slices[

[FFmpeg-devel] [PATCH v3 8/9] Changelog: D3D12VA hardware accelerated H264, HEVC, VP9, AV1, MPEG-2 and VC1 decoding

2023-06-02 Thread Tong Wu
From: Wu Jianhua 

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index 3d197f2b94..d03feb485d 100644
--- a/Changelog
+++ b/Changelog
@@ -14,6 +14,7 @@ version :
 - color_vulkan filter
 - bwdif_vulkan filter
 - nlmeans_vulkan filter
+- D3D12VA hardware accelerated H264, HEVC, VP9, AV1, MPEG-2 and VC1 decoding
 
 version 6.0:
 - Radiance HDR image support
-- 
2.35.1.windows.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 9/9] avcodec/d3d12va_hevc: enable allow_profile_mismatch flag for d3d12va msp profile

2023-06-02 Thread Tong Wu
Same as d3d11va, this flag enables main still picture profile for
d3d12va. User should add this flag when decoding main still picture
profile.

Signed-off-by: Tong Wu 
---
 libavcodec/d3d12va_hevc.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/d3d12va_hevc.c b/libavcodec/d3d12va_hevc.c
index 1d94831e01..59ca500eb2 100644
--- a/libavcodec/d3d12va_hevc.c
+++ b/libavcodec/d3d12va_hevc.c
@@ -181,8 +181,13 @@ static int d3d12va_hevc_decode_init(AVCodecContext *avctx)
 break;
 
 case FF_PROFILE_HEVC_MAIN_STILL_PICTURE:
-av_log(avctx, AV_LOG_ERROR, "D3D12 doesn't support 
PROFILE_HEVC_MAIN_STILL_PICTURE!\n");
-return AVERROR(EINVAL);
+if (avctx->hwaccel_flags & AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH) {
+ctx->cfg.DecodeProfile = D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN;
+break;
+} else {
+av_log(avctx, AV_LOG_ERROR, "D3D12 doesn't support 
PROFILE_HEVC_MAIN_STILL_PICTURE!\n");
+return AVERROR(EINVAL);
+}
 
 case FF_PROFILE_HEVC_MAIN:
 default:
-- 
2.35.1.windows.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 7/9] avcodec: add D3D12VA hardware accelerated VC1 decoding

2023-06-02 Thread Tong Wu
From: Wu Jianhua 

The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua 
Signed-off-by: Tong Wu 
---
 configure   |   3 +
 libavcodec/Makefile |   1 +
 libavcodec/d3d12va_vc1.c| 214 
 libavcodec/dxva2_internal.h |   4 +
 libavcodec/dxva2_vc1.c  |  11 +-
 libavcodec/hwaccels.h   |   2 +
 libavcodec/vc1dec.c |   9 ++
 7 files changed, 239 insertions(+), 5 deletions(-)
 create mode 100644 libavcodec/d3d12va_vc1.c

diff --git a/configure b/configure
index 9f8c535f5c..c4a93a9d6e 100755
--- a/configure
+++ b/configure
@@ -3107,6 +3107,8 @@ vc1_d3d11va_hwaccel_deps="d3d11va"
 vc1_d3d11va_hwaccel_select="vc1_decoder"
 vc1_d3d11va2_hwaccel_deps="d3d11va"
 vc1_d3d11va2_hwaccel_select="vc1_decoder"
+vc1_d3d12va_hwaccel_deps="d3d12va"
+vc1_d3d12va_hwaccel_select="vc1_decoder"
 vc1_dxva2_hwaccel_deps="dxva2"
 vc1_dxva2_hwaccel_select="vc1_decoder"
 vc1_nvdec_hwaccel_deps="nvdec"
@@ -3137,6 +3139,7 @@ vp9_videotoolbox_hwaccel_deps="videotoolbox"
 vp9_videotoolbox_hwaccel_select="vp9_decoder"
 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
 wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
+wmv3_d3d12va_hwaccel_select="vc1_d3d12va_hwaccel"
 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
 wmv3_nvdec_hwaccel_select="vc1_nvdec_hwaccel"
 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 98d4ff814d..9d5350d6e1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1030,6 +1030,7 @@ OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL)+= vdpau_mpeg4.o
 OBJS-$(CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
 OBJS-$(CONFIG_VC1_D3D11VA_HWACCEL)+= dxva2_vc1.o
 OBJS-$(CONFIG_VC1_DXVA2_HWACCEL)  += dxva2_vc1.o
+OBJS-$(CONFIG_VC1_D3D12VA_HWACCEL)+= dxva2_vc1.o d3d12va_vc1.o
 OBJS-$(CONFIG_VC1_NVDEC_HWACCEL)  += nvdec_vc1.o
 OBJS-$(CONFIG_VC1_QSV_HWACCEL)+= qsvdec.o
 OBJS-$(CONFIG_VC1_VAAPI_HWACCEL)  += vaapi_vc1.o
diff --git a/libavcodec/d3d12va_vc1.c b/libavcodec/d3d12va_vc1.c
new file mode 100644
index 00..d577582a3f
--- /dev/null
+++ b/libavcodec/d3d12va_vc1.c
@@ -0,0 +1,214 @@
+/*
+ * Direct3D12 WMV3/VC-1 HW acceleration
+ *
+ * copyright (c) 2022-2023 Wu Jianhua 
+ *
+ * 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 "config_components.h"
+#include "libavutil/avassert.h"
+#include "libavutil/hwcontext_d3d12va_internal.h"
+#include "mpegutils.h"
+#include "mpegvideodec.h"
+#include "vc1.h"
+#include "vc1data.h"
+#include "d3d12va.h"
+#include "dxva2_internal.h"
+
+#define MAX_SLICES  1024
+#define INVALID_REF 0x
+
+#define REF_RESOURCE(index) if (index != INVALID_REF) { \
+ctx->ref_resources[index] = frames_hwctx->texture_infos[index].texture; \
+}
+
+typedef struct D3D12DecodePictureContext {
+DXVA_PictureParameters pp;
+unsigned   slice_count;
+DXVA_SliceInfo slices[MAX_SLICES];
+const uint8_t *bitstream;
+unsigned   bitstream_size;
+} D3D12DecodePictureContext;
+
+static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const 
uint8_t *buffer,  av_unused uint32_t size)
+{
+const VC1Context  *v   = avctx->priv_data;
+D3D12VADecodeContext  *ctx = D3D12VA_DECODE_CONTEXT(avctx);
+D3D12DecodePictureContext *ctx_pic = 
v->s.current_picture_ptr->hwaccel_picture_private;
+
+if (!ctx)
+return -1;
+
+av_assert0(ctx_pic);
+
+ff_dxva2_vc1_fill_picture_parameters(avctx, (AVDXVAContext *)ctx, 
&ctx_pic->pp);
+ctx_pic->pp.wDeblockedPictureIndex = INVALID_REF;
+
+ctx_pic->bitstream  = NULL;
+ctx_pic->bitstream_size = 0;
+ctx_pic->slice_count= 0;
+
+return 0;
+}
+
+static int d3d12va_vc1_decode_slice(AVCodecContext *avctx, const uint8_t 
*buffer, uint32_t size)
+{
+const VC1Context  *v   = avctx->priv_data;
+D3D12DecodePictureContext *ctx_pic = 
v->s.current_picture_ptr->hwaccel_picture_private;
+
+if (ctx_pic->slice_count >= MAX_SLICES) {
+return AVERROR(ERANGE);
+}
+
+if (avctx->codec_id == AV_CODEC_ID_VC1 &&
+size >= 4 && IS_MARKER(AV_RB32(buffer))) {

[FFmpeg-devel] [PATCH] lavfi/vf_blend_vulkan: fix leak on error

2023-06-02 Thread Marvin Scholz
---
 libavfilter/vf_blend_vulkan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_blend_vulkan.c b/libavfilter/vf_blend_vulkan.c
index 530f4981c2..717efcee41 100644
--- a/libavfilter/vf_blend_vulkan.c
+++ b/libavfilter/vf_blend_vulkan.c
@@ -249,7 +249,8 @@ static int blend_frame(FFFrameSync *fs)
 if (top_fc->sw_format != bottom_fc->sw_format) {
 av_log(avctx, AV_LOG_ERROR,
"Currently the sw format of the bottom video need to match 
the top!\n");
-return AVERROR(EINVAL);
+err = AVERROR(EINVAL);
+goto fail;
 }
 RET(init_filter(avctx));
 }
-- 
2.37.0 (Apple Git-136)

___
ffmpeg-devel mailing list
ffmpeg-devel@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 v11 1/6] avformat/flvenc: support mux hevc in enhanced flv

2023-06-02 Thread Lance Wang
On Fri, Jun 2, 2023 at 3:31 PM Steven Liu  wrote:

> Signed-off-by: Steven Liu 
> ---
>  libavformat/Makefile |  2 +-
>  libavformat/flv.h| 15 +++
>  libavformat/flvenc.c | 41 +++--
>  3 files changed, 47 insertions(+), 11 deletions(-)
>
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index f8ad7c6a11..1ef3d15467 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+= flacenc.o
> flacenc_header.o \
>  OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
>  OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
>  OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
> -OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o
> +OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o
>  OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
>  OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
>  OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
> diff --git a/libavformat/flv.h b/libavformat/flv.h
> index 3571b90279..91e0a4140c 100644
> --- a/libavformat/flv.h
> +++ b/libavformat/flv.h
> @@ -35,6 +35,12 @@
>
>  #define FLV_VIDEO_FRAMETYPE_OFFSET   4
>
> +/* Extended VideoTagHeader
> + * defined in reference link:
> + *
> https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
> + * */
> +#define FLV_IS_EX_HEADER  0x80
> +
>  /* bitmasks to isolate specific values */
>  #define FLV_AUDIO_CHANNEL_MASK0x01
>  #define FLV_AUDIO_SAMPLESIZE_MASK 0x02
> @@ -112,6 +118,15 @@ enum {
>  FLV_CODECID_MPEG4   = 9,
>  };
>
> +enum {
> +PacketTypeSequenceStart = 0,
> +PacketTypeCodedFrames   = 1,
> +PacketTypeSequenceEnd   = 2,
> +PacketTypeCodedFramesX  = 3,
> +PacketTypeMetadata  = 4,
> +PacketTypeMPEG2TSSequenceStart  = 5,
> +};
> +
>

format and align the "="?



>  enum {
>  FLV_FRAME_KEY= 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< key
> frame (for AVC, a seekable frame)
>  FLV_FRAME_INTER  = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///<
> inter frame (for AVC, a non-seekable frame)
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 721f062811..aed0946a2e 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -28,6 +28,7 @@
>  #include "libavcodec/mpeg4audio.h"
>  #include "avio.h"
>  #include "avc.h"
> +#include "hevc.h"
>  #include "avformat.h"
>  #include "flv.h"
>  #include "internal.h"
> @@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
>  { AV_CODEC_ID_VP6,  FLV_CODECID_VP6 },
>  { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A },
>  { AV_CODEC_ID_H264, FLV_CODECID_H264 },
> +{ AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
>  { AV_CODEC_ID_NONE, 0 }
>  };
>
> @@ -489,7 +491,7 @@ static void flv_write_codec_header(AVFormatContext* s,
> AVCodecParameters* par, i
>  FLVContext *flv = s->priv_data;
>
>  if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id ==
> AV_CODEC_ID_H264
> -|| par->codec_id == AV_CODEC_ID_MPEG4) {
> +|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id ==
> AV_CODEC_ID_HEVC) {
>  int64_t pos;
>  avio_w8(pb,
>  par->codec_type == AVMEDIA_TYPE_VIDEO ?
> @@ -532,10 +534,19 @@ static void flv_write_codec_header(AVFormatContext*
> s, AVCodecParameters* par, i
>  }
>  avio_write(pb, par->extradata, par->extradata_size);
>  } else {
> -avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
> -avio_w8(pb, 0); // AVC sequence header
> -avio_wb24(pb, 0); // composition time
> -ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
> +if (par->codec_id == AV_CODEC_ID_HEVC) {
> +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart |
> FLV_FRAME_KEY); // ExVideoTagHeader mode with PacketTypeSequenceStart
> +avio_write(pb, "hvc1", 4);
>
 ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0);


> +} else {
> +avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
> +avio_w8(pb, 0); // AVC sequence header
> +avio_wb24(pb, 0); // composition time
>

ff_isom_write_avcc(pb, par->extradata, par->extradata_size);


> +}
> +
> +if (par->codec_id == AV_CODEC_ID_HEVC)
> +ff_isom_write_hvcc(pb, par->extradata,
> par->extradata_size, 0);
> +else
> +ff_isom_write_avcc(pb, par->extradata,
> par->extradata_size);
>

merge the if else?

 }
>  data_size = avio_tell(pb) - pos;
>  avio_seek(pb, -data_size - 10, SEEK_CUR);
> @@ -821,6 +832,7 @@ static int flv_write_packet(AVFormatContext *s,
> AVPacket *pkt)
>  unsigned ts;
>  int size = pkt->size;
>  uint8_t *data = NULL;
> +uint8_t frametype 

Re: [FFmpeg-devel] [PATCH v11 2/6] avformat/flvdec: support demux hevc in enhanced flv

2023-06-02 Thread Lance Wang
On Fri, Jun 2, 2023 at 3:32 PM Steven Liu  wrote:

> Signed-off-by: Steven Liu 
> ---
>  libavformat/flvdec.c | 58 ++--
>  1 file changed, 50 insertions(+), 8 deletions(-)
>
> diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> index d83edff727..c8e6cadf1c 100644
> --- a/libavformat/flvdec.c
> +++ b/libavformat/flvdec.c
> @@ -79,6 +79,8 @@ typedef struct FLVContext {
>  int64_t last_ts;
>  int64_t time_offset;
>  int64_t time_pos;
> +
> +uint8_t exheader;
>  } FLVContext;
>
>  /* AMF date type */
> @@ -302,13 +304,25 @@ static void flv_set_audio_codec(AVFormatContext *s,
> AVStream *astream,
>  }
>  }
>
> -static int flv_same_video_codec(AVCodecParameters *vpar, int flags)
> +static int flv_same_video_codec(AVFormatContext *s, AVCodecParameters
> *vpar, int flags)
>  {
>  int flv_codecid = flags & FLV_VIDEO_CODECID_MASK;
> +FLVContext *flv = s->priv_data;
>
>  if (!vpar->codec_id && !vpar->codec_tag)
>  return 1;
>
> +if (flv->exheader) {
> +uint8_t *codec_id_str = (uint8_t *)s->pb->buf_ptr;
> +uint32_t codec_id = codec_id_str[3] | codec_id_str[2] << 8 |
> codec_id_str[1] << 16 | codec_id_str[0] << 24;
> +switch(codec_id) {
> +case MKBETAG('h', 'v', 'c', '1'):
> +return vpar->codec_id == AV_CODEC_ID_HEVC;
> +default:
> +break;
> +}
> +}
> +
>  switch (flv_codecid) {
>  case FLV_CODECID_H263:
>  return vpar->codec_id == AV_CODEC_ID_FLV1;
> @@ -331,9 +345,24 @@ static int flv_set_video_codec(AVFormatContext *s,
> AVStream *vstream,
> int flv_codecid, int read)
>  {
>  FFStream *const vstreami = ffstream(vstream);
> +FLVContext *flv = s->priv_data;
>  int ret = 0;
>  AVCodecParameters *par = vstream->codecpar;
>  enum AVCodecID old_codec_id = vstream->codecpar->codec_id;
> +flv_codecid &= FLV_VIDEO_CODECID_MASK;
> +
> +if (flv->exheader) {
> +uint32_t codec_id = avio_rb32(s->pb);
> +
> +switch(codec_id) {
> +case MKBETAG('h', 'v', 'c', '1'):
> +par->codec_id = AV_CODEC_ID_HEVC;
> +vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
> +return 4;
> +default:
> +break;
> +}
> +}
>  switch (flv_codecid) {
>  case FLV_CODECID_H263:
>  par->codec_id = AV_CODEC_ID_FLV1;
> @@ -796,6 +825,7 @@ static int flv_read_header(AVFormatContext *s)
>  s->start_time = 0;
>  flv->sum_flv_tag_size = 0;
>  flv->last_keyframe_stream_index = -1;
> +flv->exheader = 0;
>
>  return 0;
>  }
> @@ -1071,6 +1101,11 @@ retry:
>  } else if (type == FLV_TAG_TYPE_VIDEO) {
>  stream_type = FLV_STREAM_TYPE_VIDEO;
>  flags= avio_r8(s->pb);
> +/*
> + * Reference Enhancing FLV 2023-03-v1.0.0-B.8
> + *
> https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
> + * */
> +flv->exheader = (flags >> 7) & 1;
>  size--;
>  if ((flags & FLV_VIDEO_FRAMETYPE_MASK) ==
> FLV_FRAME_VIDEO_INFO_CMD)
>  goto skip;
> @@ -1129,7 +1164,7 @@ skip:
>  break;
>  } else if (stream_type == FLV_STREAM_TYPE_VIDEO) {
>  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
> -(s->video_codec_id || flv_same_video_codec(st->codecpar,
> flags)))
> +(s->video_codec_id || flv_same_video_codec(s,
> st->codecpar, flags)))
>  break;
>  } else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) {
>  if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
> @@ -1230,7 +1265,7 @@ retry_duration:
>  avcodec_parameters_free(&par);
>  }
>  } else if (stream_type == FLV_STREAM_TYPE_VIDEO) {
> -int ret = flv_set_video_codec(s, st, flags &
> FLV_VIDEO_CODECID_MASK, 1);
> +int ret = flv_set_video_codec(s, st, flags, 1);
>  if (ret < 0)
>  return ret;
>  size -= ret;
> @@ -1242,16 +1277,23 @@ retry_duration:
>
>  if (st->codecpar->codec_id == AV_CODEC_ID_AAC ||
>  st->codecpar->codec_id == AV_CODEC_ID_H264 ||
> -st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
> -int type = avio_r8(s->pb);
> -size--;
> +st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
> +st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
> +int type = 0;
>

int type;

+if (flv->exheader && stream_type == FLV_STREAM_TYPE_VIDEO) {
> +type = flags & 0x0F;
> +} else {
> +type = avio_r8(s->pb);
> +size--;
> +}
>
>  if (size < 0) {
>  ret = AVERROR_INVALIDDATA;
>  goto leave;
>  }
>
> -if (st->codecpar->codec_id == AV_CODEC_ID_H264 ||
> st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
> +if (st->codecpa

Re: [FFmpeg-devel] [PATCH v11 1/6] avformat/flvenc: support mux hevc in enhanced flv

2023-06-02 Thread Steven Liu
Lance Wang  于2023年6月2日周五 19:09写道:
>
> On Fri, Jun 2, 2023 at 3:31 PM Steven Liu  wrote:
>
> > Signed-off-by: Steven Liu 
> > ---
> >  libavformat/Makefile |  2 +-
> >  libavformat/flv.h| 15 +++
> >  libavformat/flvenc.c | 41 +++--
> >  3 files changed, 47 insertions(+), 11 deletions(-)
> >
> > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > index f8ad7c6a11..1ef3d15467 100644
> > --- a/libavformat/Makefile
> > +++ b/libavformat/Makefile
> > @@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+= flacenc.o
> > flacenc_header.o \
> >  OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
> >  OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
> >  OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
> > -OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o
> > +OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o
> >  OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
> >  OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
> >  OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
> > diff --git a/libavformat/flv.h b/libavformat/flv.h
> > index 3571b90279..91e0a4140c 100644
> > --- a/libavformat/flv.h
> > +++ b/libavformat/flv.h
> > @@ -35,6 +35,12 @@
> >
> >  #define FLV_VIDEO_FRAMETYPE_OFFSET   4
> >
> > +/* Extended VideoTagHeader
> > + * defined in reference link:
> > + *
> > https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
> > + * */
> > +#define FLV_IS_EX_HEADER  0x80
> > +
> >  /* bitmasks to isolate specific values */
> >  #define FLV_AUDIO_CHANNEL_MASK0x01
> >  #define FLV_AUDIO_SAMPLESIZE_MASK 0x02
> > @@ -112,6 +118,15 @@ enum {
> >  FLV_CODECID_MPEG4   = 9,
> >  };
> >
> > +enum {
> > +PacketTypeSequenceStart = 0,
> > +PacketTypeCodedFrames   = 1,
> > +PacketTypeSequenceEnd   = 2,
> > +PacketTypeCodedFramesX  = 3,
> > +PacketTypeMetadata  = 4,
> > +PacketTypeMPEG2TSSequenceStart  = 5,
> > +};
> > +
> >
>
> format and align the "="?
yes it is aligned in patch, you can reference in
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20230602073109.14086-2...@chinaffmpeg.org/
>
>
>
> >  enum {
> >  FLV_FRAME_KEY= 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///< key
> > frame (for AVC, a seekable frame)
> >  FLV_FRAME_INTER  = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///<
> > inter frame (for AVC, a non-seekable frame)
> > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > index 721f062811..aed0946a2e 100644
> > --- a/libavformat/flvenc.c
> > +++ b/libavformat/flvenc.c
> > @@ -28,6 +28,7 @@
> >  #include "libavcodec/mpeg4audio.h"
> >  #include "avio.h"
> >  #include "avc.h"
> > +#include "hevc.h"
> >  #include "avformat.h"
> >  #include "flv.h"
> >  #include "internal.h"
> > @@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
> >  { AV_CODEC_ID_VP6,  FLV_CODECID_VP6 },
> >  { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A },
> >  { AV_CODEC_ID_H264, FLV_CODECID_H264 },
> > +{ AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
> >  { AV_CODEC_ID_NONE, 0 }
> >  };
> >
> > @@ -489,7 +491,7 @@ static void flv_write_codec_header(AVFormatContext* s,
> > AVCodecParameters* par, i
> >  FLVContext *flv = s->priv_data;
> >
> >  if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id ==
> > AV_CODEC_ID_H264
> > -|| par->codec_id == AV_CODEC_ID_MPEG4) {
> > +|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id ==
> > AV_CODEC_ID_HEVC) {
> >  int64_t pos;
> >  avio_w8(pb,
> >  par->codec_type == AVMEDIA_TYPE_VIDEO ?
> > @@ -532,10 +534,19 @@ static void flv_write_codec_header(AVFormatContext*
> > s, AVCodecParameters* par, i
> >  }
> >  avio_write(pb, par->extradata, par->extradata_size);
> >  } else {
> > -avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
> > -avio_w8(pb, 0); // AVC sequence header
> > -avio_wb24(pb, 0); // composition time
> > -ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
> > +if (par->codec_id == AV_CODEC_ID_HEVC) {
> > +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart |
> > FLV_FRAME_KEY); // ExVideoTagHeader mode with PacketTypeSequenceStart
> > +avio_write(pb, "hvc1", 4);
> >
>  ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0);
>
>
> > +} else {
> > +avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
> > +avio_w8(pb, 0); // AVC sequence header
> > +avio_wb24(pb, 0); // composition time
> >
>
> ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
>
>
> > +}
> > +
> > +if (par->codec_id == AV_CODEC_ID_HEVC)
> > +ff_isom_write_hvcc(pb, par->extradata,
> > par->extradata_size, 0);

Re: [FFmpeg-devel] [PATCH] lavc/aarch64: new optimization for 8-bit hevc_pel_uni_w_pixels, qpel_uni_w_h, qpel_uni_w_v, qpel_uni_w_hv and qpel_h

2023-06-02 Thread Logan.Lyu

Hi, Martin,

I'm sorry I made a stupid mistake, And it's fixed now.

If these patches are acceptable to you, I will submit some similar 
patches soon.


Thanks.


在 2023/6/1 19:23, Martin Storsjö 写道:

On Sun, 28 May 2023, Logan.Lyu wrote:



在 2023/5/28 12:36, Jean-Baptiste Kempf 写道:

Hello,

The last interaction still has the wrong name in patchset.

Thanks for reminding.  I modified the correct name in git.


Thanks, most of the issues in the patch seem to have been fixed - 
however there's one big breakage here. Also even if this is accepted, 
we'll have to wait for the dependency patches to be merged before 
these can go in though.


For restoring the saved registers on the stack, you currently have this:

    ldp x19, x30, [sp]
    ldp x26, x27, [sp, #16]
    ldp x24, x25, [sp, #32]
    ldp x22, x23, [sp, #48]
    ldp x20, x21, [sp, #64]
    add sp, sp, #80

You can avoid the extra add at the end by reordering them like this:

    ldp x26, x27, [sp, #16]
    ldp x24, x25, [sp, #32]
    ldp x22, x23, [sp, #48]
    ldp x20, x21, [sp, #64]
    ldp x19, x30, [sp], #80

But the order/layout of the registers doesn't match how they are 
backed up. So when you run checkasm, you'll get these errors:


I8MM:
 - hevc_pel.qpel   [OK]
   put_hevc_qpel_uni_w_hv4_8_i8mm (failed to preserve register)
   put_hevc_qpel_uni_w_hv8_8_i8mm (failed to preserve register)
   put_hevc_qpel_uni_w_hv16_8_i8mm (failed to preserve register)
   put_hevc_qpel_uni_w_hv32_8_i8mm (failed to preserve register)
   put_hevc_qpel_uni_w_hv64_8_i8mm (failed to preserve register)
 - hevc_pel.qpel_uni_w [FAILED]
checkasm: 5 of 1136 tests have failed

It's easiest to make the epilogue a mirror copy of the prologue.

Please rerun checkasm on as system that does support i8mm when posting 
updated patches.


// Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".From 8d5875ab393828b83163b98eb4b35837120f1322 Mon Sep 17 00:00:00 2001
From: Logan Lyu 
Date: Wed, 3 May 2023 09:53:07 +0800
Subject: [PATCH 1/3] lavc/aarch64: new optimization for 8-bit
 hevc_pel_uni_w_pixels and qpel_uni_w_v

---
 libavcodec/aarch64/hevcdsp_init_aarch64.c |  51 ++
 libavcodec/aarch64/hevcdsp_qpel_neon.S| 710 ++
 2 files changed, 761 insertions(+)

diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c 
b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index be1049a2ec..6b5341dd45 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -128,6 +128,52 @@ void ff_hevc_put_hevc_qpel_bi_h16_8_neon(uint8_t *_dst, 
ptrdiff_t _dststride, co
  ptrdiff_t _srcstride, const int16_t 
*src2, int height, intptr_t
  mx, intptr_t my, int width);
 
+#define NEON8_FNPROTO(fn, args, ext) \
+void ff_hevc_put_hevc_##fn##4_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##6_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##8_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##12_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##16_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##24_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##32_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##48_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##64_8_neon##ext args; \
+
+#define NEON8_FNPROTO_PARTIAL_4(fn, args, ext) \
+void ff_hevc_put_hevc_##fn##4_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##8_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##16_8_neon##ext args; \
+void ff_hevc_put_hevc_##fn##64_8_neon##ext args; \
+
+NEON8_FNPROTO(pel_uni_w_pixels, (uint8_t *_dst, ptrdiff_t _dststride,
+const uint8_t *_src, ptrdiff_t _srcstride,
+int height, int denom, int wx, int ox,
+intptr_t mx, intptr_t my, int width),);
+
+NEON8_FNPROTO_PARTIAL_4(qpel_uni_w_v, (uint8_t *_dst,  ptrdiff_t _dststride,
+const uint8_t *_src, ptrdiff_t _srcstride,
+int height, int denom, int wx, int ox,
+intptr_t mx, intptr_t my, int width),);
+
+#define NEON8_FNASSIGN(member, v, h, fn, ext) \
+member[1][v][h] = ff_hevc_put_hevc_##fn##4_8_neon##ext;  \
+member[2][v][h] = ff_hevc_put_hevc_##fn##6_8_neon##ext;  \
+member[3][v][h] = ff_hevc_put_hevc_##fn##8_8_neon##ext;  \
+member[4][v][h] = ff_hevc_put_hevc_##fn##12_8_neon##ext; \
+member[5][v][h] = ff_hevc_put_hevc_##fn##16_8_neon##ext; \
+member[6][v][h] = ff_hevc_put_hevc_##fn##24_8_neon##ext; \
+member[7][v][h] = ff_hevc_put_hevc_##fn##32_8_neon##ext; \
+member[8][v][h] = ff_hevc_

Re: [FFmpeg-devel] [PATCH v4 0/2] Animated JPEG XL Support

2023-06-02 Thread Leo Izen

On 5/26/23 16:55, Leo Izen wrote:

Changes from v3:
  - Use avctx->internal->in_pkt instead of allocating a new packet.

Leo Izen (2):
   avcodec/libjxldec: add animated decode support
   avformat/jpegxl_anim_dec: add animated JPEG XL demuxer



Will rebase onto master and merge soon, if there's no objections.

- Leo Izen (Traneptora / thebombzen)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avcodec/cbs: reset the fragment on reading failure

2023-06-02 Thread James Almer
Fixes: NULL pointer dereference
Fixes: 
59359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-6726080594313216

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer 
---
 libavcodec/cbs.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 504197e06d..ba134c1db2 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -249,8 +249,10 @@ static int cbs_read_data(CodedBitstreamContext *ctx,
 
 if (buf) {
 frag->data_ref = av_buffer_ref(buf);
-if (!frag->data_ref)
-return AVERROR(ENOMEM);
+if (!frag->data_ref) {
+err = AVERROR(ENOMEM);
+goto end;
+}
 
 frag->data  = (uint8_t *)data;
 frag->data_size = size;
@@ -258,14 +260,20 @@ static int cbs_read_data(CodedBitstreamContext *ctx,
 } else {
 err = cbs_fill_fragment_data(frag, data, size);
 if (err < 0)
-return err;
+goto end;
 }
 
 err = ctx->codec->split_fragment(ctx, frag, header);
 if (err < 0)
-return err;
+goto end;
 
-return cbs_read_fragment_content(ctx, frag);
+err = cbs_read_fragment_content(ctx, frag);
+
+end:
+if (err < 0)
+ff_cbs_fragment_reset(frag);
+
+return err;
 }
 
 int ff_cbs_read_extradata(CodedBitstreamContext *ctx,
-- 
2.40.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 v11 1/6] avformat/flvenc: support mux hevc in enhanced flv

2023-06-02 Thread Lance Wang
On Fri, Jun 2, 2023 at 7:29 PM Steven Liu  wrote:

> Lance Wang  于2023年6月2日周五 19:09写道:
> >
> > On Fri, Jun 2, 2023 at 3:31 PM Steven Liu  wrote:
> >
> > > Signed-off-by: Steven Liu 
> > > ---
> > >  libavformat/Makefile |  2 +-
> > >  libavformat/flv.h| 15 +++
> > >  libavformat/flvenc.c | 41 +++--
> > >  3 files changed, 47 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > > index f8ad7c6a11..1ef3d15467 100644
> > > --- a/libavformat/Makefile
> > > +++ b/libavformat/Makefile
> > > @@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+=
> flacenc.o
> > > flacenc_header.o \
> > >  OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
> > >  OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
> > >  OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
> > > -OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o
> > > +OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o
> > >  OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
> > >  OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
> > >  OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
> > > diff --git a/libavformat/flv.h b/libavformat/flv.h
> > > index 3571b90279..91e0a4140c 100644
> > > --- a/libavformat/flv.h
> > > +++ b/libavformat/flv.h
> > > @@ -35,6 +35,12 @@
> > >
> > >  #define FLV_VIDEO_FRAMETYPE_OFFSET   4
> > >
> > > +/* Extended VideoTagHeader
> > > + * defined in reference link:
> > > + *
> > >
> https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
> > > + * */
> > > +#define FLV_IS_EX_HEADER  0x80
> > > +
> > >  /* bitmasks to isolate specific values */
> > >  #define FLV_AUDIO_CHANNEL_MASK0x01
> > >  #define FLV_AUDIO_SAMPLESIZE_MASK 0x02
> > > @@ -112,6 +118,15 @@ enum {
> > >  FLV_CODECID_MPEG4   = 9,
> > >  };
> > >
> > > +enum {
> > > +PacketTypeSequenceStart = 0,
> > > +PacketTypeCodedFrames   = 1,
> > > +PacketTypeSequenceEnd   = 2,
> > > +PacketTypeCodedFramesX  = 3,
> > > +PacketTypeMetadata  = 4,
> > > +PacketTypeMPEG2TSSequenceStart  = 5,
> > > +};
> > > +
> > >
> >
> > format and align the "="?
> yes it is aligned in patch, you can reference in
>
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20230602073109.14086-2...@chinaffmpeg.org/
> >
> >
> >
> > >  enum {
> > >  FLV_FRAME_KEY= 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///<
> key
> > > frame (for AVC, a seekable frame)
> > >  FLV_FRAME_INTER  = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///<
> > > inter frame (for AVC, a non-seekable frame)
> > > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > > index 721f062811..aed0946a2e 100644
> > > --- a/libavformat/flvenc.c
> > > +++ b/libavformat/flvenc.c
> > > @@ -28,6 +28,7 @@
> > >  #include "libavcodec/mpeg4audio.h"
> > >  #include "avio.h"
> > >  #include "avc.h"
> > > +#include "hevc.h"
> > >  #include "avformat.h"
> > >  #include "flv.h"
> > >  #include "internal.h"
> > > @@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
> > >  { AV_CODEC_ID_VP6,  FLV_CODECID_VP6 },
> > >  { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A },
> > >  { AV_CODEC_ID_H264, FLV_CODECID_H264 },
> > > +{ AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
> > >  { AV_CODEC_ID_NONE, 0 }
> > >  };
> > >
> > > @@ -489,7 +491,7 @@ static void
> flv_write_codec_header(AVFormatContext* s,
> > > AVCodecParameters* par, i
> > >  FLVContext *flv = s->priv_data;
> > >
> > >  if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id ==
> > > AV_CODEC_ID_H264
> > > -|| par->codec_id == AV_CODEC_ID_MPEG4) {
> > > +|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id ==
> > > AV_CODEC_ID_HEVC) {
> > >  int64_t pos;
> > >  avio_w8(pb,
> > >  par->codec_type == AVMEDIA_TYPE_VIDEO ?
> > > @@ -532,10 +534,19 @@ static void
> flv_write_codec_header(AVFormatContext*
> > > s, AVCodecParameters* par, i
> > >  }
> > >  avio_write(pb, par->extradata, par->extradata_size);
> > >  } else {
> > > -avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
> > > -avio_w8(pb, 0); // AVC sequence header
> > > -avio_wb24(pb, 0); // composition time
> > > -ff_isom_write_avcc(pb, par->extradata,
> par->extradata_size);
> > > +if (par->codec_id == AV_CODEC_ID_HEVC) {
> > > +avio_w8(pb, FLV_IS_EX_HEADER |
> PacketTypeSequenceStart |
> > > FLV_FRAME_KEY); // ExVideoTagHeader mode with PacketTypeSequenceStart
> > > +avio_write(pb, "hvc1", 4);
> > >
> >  ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0);
> >
> >
> > > +} else {
> > > +avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
> > > +avio_w8(pb, 0); // AVC sequence

[FFmpeg-devel] [PATCH] lavfi/vf_xfade: rewrite activate inputs handling

2023-06-02 Thread Marvin Scholz
The old code was not properly handling a bunch of edge-cases with
streams terminating earlier and also did not properly report back EOF
to the first input.

This fixes at least one case where the filter could stop doing
anything:

ffmpeg -f lavfi -i "color=blue:d=10" -f lavfi -i "color=aqua:d=0" 
-filter_complex "[0][1]xfade=duration=2:offset=0:transition=wiperight" -f null -
---
 libavfilter/vf_xfade.c | 208 -
 1 file changed, 120 insertions(+), 88 deletions(-)

diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c
index a13a7db627..f98ff81918 100644
--- a/libavfilter/vf_xfade.c
+++ b/libavfilter/vf_xfade.c
@@ -95,14 +95,23 @@ typedef struct XFadeContext {
 int depth;
 int is_rgb;
 
+// PTS when the fade should start (in first inputs timebase)
+int64_t start_pts;
+
+// PTS offset between first and second input
+int64_t inputs_offset_pts;
+
+// Duration of the transition
 int64_t duration_pts;
-int64_t offset_pts;
-int64_t first_pts;
-int64_t last_pts;
+
+// Current PTS of the first input
 int64_t pts;
-int xfade_is_over;
-int need_second;
-int eof[2];
+
+// If frames are currently just passed through unmodified,
+// like before and after the actual transition.
+int passthrough;
+
+int status[2];
 AVFrame *xf[2];
 int max_value;
 uint16_t black[4];
@@ -1935,12 +1944,10 @@ static int config_output(AVFilterLink *outlink)
 s->white[0] = s->white[3] = s->max_value;
 s->white[1] = s->white[2] = s->is_rgb ? s->max_value : s->max_value / 2;
 
-s->first_pts = s->last_pts = s->pts = AV_NOPTS_VALUE;
+s->start_pts = s->inputs_offset_pts = AV_NOPTS_VALUE;
 
 if (s->duration)
 s->duration_pts = av_rescale_q(s->duration, AV_TIME_BASE_Q, 
outlink->time_base);
-if (s->offset)
-s->offset_pts = av_rescale_q(s->offset, AV_TIME_BASE_Q, 
outlink->time_base);
 
 switch (s->transition) {
 case CUSTOM: s->transitionf = s->depth <= 8 ? custom8_transition : 
custom16_transition; break;
@@ -2037,7 +2044,7 @@ static int xfade_frame(AVFilterContext *ctx, AVFrame *a, 
AVFrame *b)
 {
 XFadeContext *s = ctx->priv;
 AVFilterLink *outlink = ctx->outputs[0];
-float progress = av_clipf(1.f - ((float)(s->pts - s->first_pts - 
s->offset_pts) / s->duration_pts), 0.f, 1.f);
+float progress = av_clipf(1.f - ((float)(s->pts - s->start_pts) / 
s->duration_pts), 0.f, 1.f);
 ThreadData td;
 AVFrame *out;
 
@@ -2055,99 +2062,124 @@ static int xfade_frame(AVFilterContext *ctx, AVFrame 
*a, AVFrame *b)
 return ff_filter_frame(outlink, out);
 }
 
-static int xfade_activate(AVFilterContext *ctx)
+static int forward_frame(XFadeContext *s,
+ AVFilterLink *inlink, AVFilterLink *outlink)
 {
-XFadeContext *s = ctx->priv;
-AVFilterLink *outlink = ctx->outputs[0];
-AVFrame *in = NULL;
+int64_t status_pts;
 int ret = 0, status;
-int64_t pts;
+AVFrame *frame = NULL;
 
-FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx);
+ret = ff_inlink_consume_frame(inlink, &frame);
+if (ret < 0)
+return ret;
 
-if (s->xfade_is_over) {
-if (!s->eof[0]) {
-if (ff_inlink_queued_frames(ctx->inputs[0]) > 0) {
-ret = ff_inlink_consume_frame(ctx->inputs[0], &in);
-if (ret > 0)
-av_frame_free(&in);
-}
-ff_inlink_set_status(ctx->inputs[0], AVERROR_EOF);
-s->eof[0] = 1;
-}
-ret = ff_inlink_consume_frame(ctx->inputs[1], &in);
-if (ret < 0) {
-return ret;
-} else if (ret > 0) {
-in->pts = (in->pts - s->last_pts) + s->pts;
-return ff_filter_frame(outlink, in);
-} else if (ff_inlink_acknowledge_status(ctx->inputs[1], &status, 
&pts)) {
-ff_outlink_set_status(outlink, status, s->pts);
-return 0;
-} else if (!ret) {
-if (ff_outlink_frame_wanted(outlink))
-ff_inlink_request_frame(ctx->inputs[1]);
-return 0;
-}
+if (ret > 0) {
+// Calculate PTS offset to first input
+if (s->inputs_offset_pts == AV_NOPTS_VALUE)
+s->inputs_offset_pts = s->pts - frame->pts;
+
+// We got a frame, nothing to do other than adjusting the timestamp
+frame->pts += s->inputs_offset_pts;
+return ff_filter_frame(outlink, frame);
 }
 
-if (ff_inlink_queued_frames(ctx->inputs[0]) > 0) {
-s->xf[0] = ff_inlink_peek_frame(ctx->inputs[0], 0);
-if (s->xf[0]) {
-if (s->first_pts == AV_NOPTS_VALUE) {
-s->first_pts = s->xf[0]->pts;
-}
-s->pts = s->xf[0]->pts;
-if (s->first_pts + s->offset_pts > s->xf[0]->pts) {
-s->xf[0] = NULL;
-s->need_second = 0;
-ff_inlink_consume_frame(ctx->inputs[0], &in

Re: [FFmpeg-devel] drawtext filter

2023-06-02 Thread Paul B Mahol
On Fri, May 26, 2023 at 2:19 PM Francesco Carusi 
wrote:

> I added a patch specifically to include cosmetic changes. I also removed
> the change log section, the forward declarations and improved error
> checking.
> The changes to the configure file are in a dedicated patch (the last
> one: 0009).
>
>
Will carefully review and apply whole set if time permits.


>
> On 20/03/2023 09:50, Paul B Mahol wrote:
> > On Mon, Mar 20, 2023 at 8:41 AM Francesco Carusi 
> > wrote:
> >
> >> Would it be ok if I split the patch so that one is dedicated to
> >> cosmetics and one to the implementation?
> >> I'll also remove the change log section and the forward declarations and
> >> improve the error checking.
> >>
> > Yes split it.
> >
> >
> > Note that reviewers here tend to review only after big time passes and
> are
> > usually nitpicking all the time.
> >
> >
> >> On 16/03/2023 17:52, Anton Khirnov wrote:
> >>> Overall this patch could use a lot more polish. I really wish you
> >>> developed it in a more review-friendly form.
> >>> The commit message should use standard form and elaborate on what
> >>> advantage do we get from this huge change, which also adds a new
> >>> dependendency.
> >>>
> >>>
> >>> Quoting Francesco Carusi (2023-02-03 15:18:21)
>  diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
>  index 50012bb258..7a0a255c5e 100644
>  --- a/libavfilter/vf_drawtext.c
>  +++ b/libavfilter/vf_drawtext.c
> >>> You are adding a bunch of trailing whitespace in the file, which is
> >>> forbidden.
> >>>
>  @@ -1,4 +1,5 @@
> /*
>  + * Copyright (c) 2023 Francesco Carusi
>  * Copyright (c) 2011 Stefano Sabatini
>  * Copyright (c) 2010 S.N. Hemanth Meenakshisundaram
>  * Copyright (c) 2003 Gustavo Sverzut Barbieri <
> >> gsbarbi...@yahoo.com.br>
>  @@ -20,6 +21,14 @@
>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> >> 02110-1301 USA
>  */
> 
>  +/*
>  + * Changelog - 2023
>  + *
>  + * - This filter now depends on libharfbuzz for text shaping.
>  + * - Glyphs position is now accurate to 1/4 pixel in both directions
>  + * - The default line height is now the one defined in the font
>  + */
> >>> This is not the place for a changelog, that's what commit messages and
> >>> the Changelog file are for.
> >>>
>  +
> /**
>  * @file
>  * drawtext filter, based on the original vhook/drawtext.c
>  @@ -72,14 +81,20 @@
> #include FT_GLYPH_H
> #include FT_STROKER_H
> 
>  +#include 
>  +#include 
>  +
>  +// Ceiling operation for positive integers division
>  +#define POS_CEIL(x, y) ((x)/(y) + ((x)%(y) != 0))
>  +
> static const char *const var_names[] = {
> "dar",
> "hsub", "vsub",
>  -"line_h", "lh",   ///< line height, same as max_glyph_h
>  +"line_h", "lh",   ///< line height
> "main_h", "h", "H",   ///< height of the input video
> "main_w", "w", "W",   ///< width  of the input video
>  -"max_glyph_a", "ascent",  ///< max glyph ascent
>  -"max_glyph_d", "descent", ///< min glyph descent
>  +"max_glyph_a", "ascent",  ///< max glyph ascender
>  +"max_glyph_d", "descent", ///< min glyph descender
> >>> Seems like this should not be in this patch.
> >>>
> static const AVOption drawtext_options[]= {
>  -{"fontfile","set font file",OFFSET(fontfile),
> >>   AV_OPT_TYPE_STRING, {.str=NULL},  0, 0, FLAGS},
>  -{"text","set text", OFFSET(text),
> >>   AV_OPT_TYPE_STRING, {.str=NULL},  0, 0, FLAGS},
>  -{"textfile","set text file",OFFSET(textfile),
> >>   AV_OPT_TYPE_STRING, {.str=NULL},  0, 0, FLAGS},
>  -{"fontcolor",   "set foreground color", OFFSET(fontcolor.rgba),
> >>   AV_OPT_TYPE_COLOR,  {.str="black"}, 0, 0, FLAGS},
>  +{"fontfile",   "set font file", OFFSET(fontfile),
> >>   AV_OPT_TYPE_STRING, {.str=NULL},  0, 0, FLAGS},
>  +{"text",   "set text",  OFFSET(text),
> >>   AV_OPT_TYPE_STRING, {.str=NULL},  0, 0, FLAGS},
>  +{"textfile",   "set text file", OFFSET(textfile),
> >>   AV_OPT_TYPE_STRING, {.str=NULL},  0, 0, FLAGS},
>  +{"fontcolor",  "set foreground color",
> >> OFFSET(fontcolor.rgba), AV_OPT_TYPE_COLOR,  {.str="black"}, 0, 0,
> >> FLAGS},
> {"fontcolor_expr", "set foreground color expression",
> >> OFFSET(fontcolor_expr), AV_OPT_TYPE_STRING, {.str=""}, 0, 0, FLAGS},
>  -{"boxcolor","set box color",OFFSET(boxcolor.rgba),
> >>AV_OPT_TYPE_COLOR,  {.str="white"}, 0, 0, FLAGS},
>  -{"bordercolor", "set border color", OFFSET(bordercolor.rgba),
> >>   AV_OPT_TYPE_COLOR,  {.str="black"}, 0, 0, FLAGS},
>  -{"shadowcolor", "set shadow color", OFFSET(

Re: [FFmpeg-devel] [PATCH v4 0/2] Animated JPEG XL Support

2023-06-02 Thread Paul B Mahol
On Fri, Jun 2, 2023 at 5:03 PM Leo Izen  wrote:

> On 5/26/23 16:55, Leo Izen wrote:
> > Changes from v3:
> >   - Use avctx->internal->in_pkt instead of allocating a new packet.
> >
> > Leo Izen (2):
> >avcodec/libjxldec: add animated decode support
> >avformat/jpegxl_anim_dec: add animated JPEG XL demuxer
> >
>
> Will rebase onto master and merge soon, if there's no objections.
>
>
Does this demuxer implementation works on non-seekable input?



> - Leo Izen (Traneptora / thebombzen)
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@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] metadata (.m4a): tag 'tmpo' is not handled

2023-06-02 Thread Leo Izen

On 6/1/23 14:48, Brad Lanam wrote:>

The 'tmpo' metadata tag within a .m4a audio file is not recognized by
ffmpeg and is never processed or output.   Neither the command line
interface nor the api returns this tag.



You should open an issue on the FFmpeg bug tracker for bug reports: 
https://trac.ffmpeg.org/


- Leo Izen (Traneptora / thebombzen)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4 0/2] Animated JPEG XL Support

2023-06-02 Thread Leo Izen

On 6/2/23 13:39, Paul B Mahol wrote:

On Fri, Jun 2, 2023 at 5:03 PM Leo Izen  wrote:


On 5/26/23 16:55, Leo Izen wrote:

Changes from v3:
   - Use avctx->internal->in_pkt instead of allocating a new packet.

Leo Izen (2):
avcodec/libjxldec: add animated decode support
avformat/jpegxl_anim_dec: add animated JPEG XL demuxer



Will rebase onto master and merge soon, if there's no objections.



Does this demuxer implementation works on non-seekable input?




It does not, because the underlying codec lacks a parser, although this 
isn't something that can be solved easily, as writing a parser is 
nontrivial.


- Leo Izen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2] lavfi/vf_xfade: rewrite activate inputs handling

2023-06-02 Thread Marvin Scholz
The old code was not properly handling a bunch of edge-cases with
streams terminating earlier and also did not properly report back EOF
to the first input.

This fixes at least one case where the filter could stop doing
anything:

ffmpeg -f lavfi -i "color=blue:d=10" -f lavfi -i "color=aqua:d=0" 
-filter_complex "[0][1]xfade=duration=2:offset=0:transition=wiperight" -f null -
---

Changes to v1:

- Fix an issue discovered by Paul where the timestmap offset was incorrectly 
calculated
  leading to one frame with identical PTS as the previous one.
- Removed accidentally introduced trailing spaces

 libavfilter/vf_xfade.c | 212 -
 1 file changed, 124 insertions(+), 88 deletions(-)

diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c
index a13a7db627..92f5139ec5 100644
--- a/libavfilter/vf_xfade.c
+++ b/libavfilter/vf_xfade.c
@@ -95,14 +95,23 @@ typedef struct XFadeContext {
 int depth;
 int is_rgb;
 
+// PTS when the fade should start (in first inputs timebase)
+int64_t start_pts;
+
+// PTS offset between first and second input
+int64_t inputs_offset_pts;
+
+// Duration of the transition
 int64_t duration_pts;
-int64_t offset_pts;
-int64_t first_pts;
-int64_t last_pts;
+
+// Current PTS of the first input
 int64_t pts;
-int xfade_is_over;
-int need_second;
-int eof[2];
+
+// If frames are currently just passed through unmodified,
+// like before and after the actual transition.
+int passthrough;
+
+int status[2];
 AVFrame *xf[2];
 int max_value;
 uint16_t black[4];
@@ -1935,12 +1944,10 @@ static int config_output(AVFilterLink *outlink)
 s->white[0] = s->white[3] = s->max_value;
 s->white[1] = s->white[2] = s->is_rgb ? s->max_value : s->max_value / 2;
 
-s->first_pts = s->last_pts = s->pts = AV_NOPTS_VALUE;
+s->start_pts = s->inputs_offset_pts = AV_NOPTS_VALUE;
 
 if (s->duration)
 s->duration_pts = av_rescale_q(s->duration, AV_TIME_BASE_Q, 
outlink->time_base);
-if (s->offset)
-s->offset_pts = av_rescale_q(s->offset, AV_TIME_BASE_Q, 
outlink->time_base);
 
 switch (s->transition) {
 case CUSTOM: s->transitionf = s->depth <= 8 ? custom8_transition : 
custom16_transition; break;
@@ -2037,7 +2044,7 @@ static int xfade_frame(AVFilterContext *ctx, AVFrame *a, 
AVFrame *b)
 {
 XFadeContext *s = ctx->priv;
 AVFilterLink *outlink = ctx->outputs[0];
-float progress = av_clipf(1.f - ((float)(s->pts - s->first_pts - 
s->offset_pts) / s->duration_pts), 0.f, 1.f);
+float progress = av_clipf(1.f - ((float)(s->pts - s->start_pts) / 
s->duration_pts), 0.f, 1.f);
 ThreadData td;
 AVFrame *out;
 
@@ -2055,99 +2062,128 @@ static int xfade_frame(AVFilterContext *ctx, AVFrame 
*a, AVFrame *b)
 return ff_filter_frame(outlink, out);
 }
 
-static int xfade_activate(AVFilterContext *ctx)
+static int forward_frame(XFadeContext *s,
+ AVFilterLink *inlink, AVFilterLink *outlink)
 {
-XFadeContext *s = ctx->priv;
-AVFilterLink *outlink = ctx->outputs[0];
-AVFrame *in = NULL;
+int64_t status_pts;
 int ret = 0, status;
-int64_t pts;
+AVFrame *frame = NULL;
 
-FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx);
+ret = ff_inlink_consume_frame(inlink, &frame);
+if (ret < 0)
+return ret;
 
-if (s->xfade_is_over) {
-if (!s->eof[0]) {
-if (ff_inlink_queued_frames(ctx->inputs[0]) > 0) {
-ret = ff_inlink_consume_frame(ctx->inputs[0], &in);
-if (ret > 0)
-av_frame_free(&in);
-}
-ff_inlink_set_status(ctx->inputs[0], AVERROR_EOF);
-s->eof[0] = 1;
-}
-ret = ff_inlink_consume_frame(ctx->inputs[1], &in);
-if (ret < 0) {
-return ret;
-} else if (ret > 0) {
-in->pts = (in->pts - s->last_pts) + s->pts;
-return ff_filter_frame(outlink, in);
-} else if (ff_inlink_acknowledge_status(ctx->inputs[1], &status, 
&pts)) {
-ff_outlink_set_status(outlink, status, s->pts);
-return 0;
-} else if (!ret) {
-if (ff_outlink_frame_wanted(outlink))
-ff_inlink_request_frame(ctx->inputs[1]);
-return 0;
-}
+if (ret > 0) {
+// If we do not have an offset yet, it's because we
+// never got a first input. Just offset to 0
+if (s->inputs_offset_pts == AV_NOPTS_VALUE)
+s->inputs_offset_pts = -frame->pts;
+
+// We got a frame, nothing to do other than adjusting the timestamp
+frame->pts += s->inputs_offset_pts;
+return ff_filter_frame(outlink, frame);
 }
 
-if (ff_inlink_queued_frames(ctx->inputs[0]) > 0) {
-s->xf[0] = ff_inlink_peek_frame(ctx->inputs[0], 0);
-if (s->xf[0]) {
-if (s->first_pts == AV_NOPTS_VALUE) {
-   

Re: [FFmpeg-devel] [PATCH 2/3] avcodec/cbs_av1: Clear obu.metadata on error

2023-06-02 Thread Michael Niedermayer
On Thu, Jun 01, 2023 at 09:33:14PM -0300, James Almer wrote:
> On 6/1/2023 9:28 PM, Andreas Rheinhardt wrote:
> > 1. Before 97f4263, the current_obu was reset (and the packet effectively
> > discarded) upon errors from ff_cbs_read_packet(); yet this is no longer
> > true and it seems that the contents of current_obu will be processed in
> > the next call to av1_receive_frame(). This change seems to have been
> > unintentional.
> 
> I guess I assumed that ff_cbs_read_packet() failing would clear the
> CodedBitstreamFragment before returning, but if that's not the case then
> ff_cbs_fragment_reset() should be called.
> 
> Would something like
> 
> > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> > index 5cc5d87c64..d1a0f6eaa2 100644
> > --- a/libavcodec/av1dec.c
> > +++ b/libavcodec/av1dec.c
> > @@ -1461,6 +1461,7 @@ static int av1_receive_frame(AVCodecContext *avctx, 
> > AVFrame *frame)
> >  ret = ff_cbs_read_packet(s->cbc, &s->current_obu, s->pkt);
> >  if (ret < 0) {
> >  av_packet_unref(s->pkt);
> > +ff_cbs_fragment_reset(&s->current_obu);
> >  av_log(avctx, AV_LOG_ERROR, "Failed to read packet.\n");
> >  return ret;
> >  }
> 
> Be enough?

yes, that solves it and looks much better than my patch

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- 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".


Re: [FFmpeg-devel] [PATCH 2/3] avcodec/cbs_av1: Clear obu.metadata on error

2023-06-02 Thread Michael Niedermayer
On Fri, Jun 02, 2023 at 02:28:24AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > On error pointers can be left NULL while code later assumes these not to be 
> > NULL
> > 
> > Fixes: NULL pointer dereference
> > Fixes: 
> > 59359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-6726080594313216
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/cbs_av1.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> > index 8788fee099..7f3f4da2f5 100644
> > --- a/libavcodec/cbs_av1.c
> > +++ b/libavcodec/cbs_av1.c
> > @@ -1013,8 +1013,10 @@ static int cbs_av1_read_unit(CodedBitstreamContext 
> > *ctx,
> >  case AV1_OBU_METADATA:
> >  {
> >  err = cbs_av1_read_metadata_obu(ctx, &gbc, &obu->obu.metadata);
> > -if (err < 0)
> > +if (err < 0) {
> > +memset(&obu->obu.metadata, 0, sizeof(obu->obu.metadata));
> >  return err;
> > +}
> >  }
> >  break;
> >  case AV1_OBU_PADDING:
> 
> 1. Before 97f4263, the current_obu was reset (and the packet effectively
> discarded) upon errors from ff_cbs_read_packet(); yet this is no longer
> true and it seems that the contents of current_obu will be processed in
> the next call to av1_receive_frame(). This change seems to have been
> unintentional.
> 2. The commit message is weird: You claim that it is bad that a pointer
> is NULL; and then you go on and zero it again. It would be better to
> claim that the metadata is in an inconsistent state.
> 3. There is a possibility for inconsistency in cbs_av1_syntax_template,
> namely if the allocation fails, metadata OBU nevertheless claims to have
> a payload_size > 0; payload_size should only be set after the allocation
> succeeded. But this does not seem to be the issue in this testcase.
> Presumably there are not enough bits left for the itu_t_t35_country_code
> or its extension? In this case, cbs_av1 did not even make an error.
> 4. Your fix is dangerous: In case the code were changed so that an error
> can happen after a successful allocation, your memset would lead to
> leaks. (The most likely possibility is the addition of a new type of
> metadata; another way would be for the code to be changed to avoid
> reading the metadata twice by reallocating (and overallocating) the
> buffer as needed.)

posting a suboptimal fix, if one isnt sure what is the clean way to fix it
is a great way to have someone else make a better fix.

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- 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 v2] lavfi/vf_xfade: rewrite activate inputs handling

2023-06-02 Thread Paul B Mahol
LGTM
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/av1dec: fix EOF check in Annex-B demuxer

2023-06-02 Thread James Almer
And return any packet buffered by the bsf.

Signed-off-by: James Almer 
---
 libavformat/av1dec.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index 216d4e2298..842dc588ab 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -131,6 +131,8 @@ static int leb(AVIOContext *pb, uint32_t *len) {
 do {
 unsigned bits;
 byte = avio_r8(pb);
+if (pb->eof_reached || pb->error)
+return pb->error ? pb->error : AVERROR_EOF;
 more = byte & 0x80;
 bits = byte & 0x7f;
 if (i <= 3 || (i == 4 && bits < (1 << 4)))
@@ -139,8 +141,6 @@ static int leb(AVIOContext *pb, uint32_t *len) {
 return AVERROR_INVALIDDATA;
 if (++i == 8 && more)
 return AVERROR_INVALIDDATA;
-if (pb->eof_reached || pb->error)
-return pb->error ? pb->error : AVERROR(EIO);
 } while (more);
 return i;
 }
@@ -235,18 +235,23 @@ retry:
 
 if (!c->temporal_unit_size) {
 len = leb(s->pb, &c->temporal_unit_size);
-if (len < 0) return AVERROR_INVALIDDATA;
+if (len == AVERROR_EOF) goto end;
+else if (len < 0) return len;
 }
 
 if (!c->frame_unit_size) {
 len = leb(s->pb, &c->frame_unit_size);
-if (len < 0 || ((int64_t)c->frame_unit_size + len) > 
c->temporal_unit_size)
+if (len < 0)
+return len == AVERROR_EOF ? AVERROR(EIO) : len;
+if (((int64_t)c->frame_unit_size + len) > c->temporal_unit_size)
 return AVERROR_INVALIDDATA;
 c->temporal_unit_size -= len;
 }
 
 len = leb(s->pb, &obu_unit_size);
-if (len < 0 || ((int64_t)obu_unit_size + len) > c->frame_unit_size)
+if (len < 0)
+return len == AVERROR_EOF ? AVERROR(EIO) : len;
+if (((int64_t)obu_unit_size + len) > c->frame_unit_size)
 return AVERROR_INVALIDDATA;
 
 ret = av_get_packet(s->pb, pkt, obu_unit_size);
-- 
2.40.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] avutil/hwcontext_vulkan: disable multiplane when deriving from cuda

2023-06-02 Thread Philip Langdale
Today, cuda is not able to import multiplane images, and cuda requires
images to be imported whether you trying to import to cuda or export
from cuda (in the later case, the image is imported and then copied
into on the cuda side). So any interop between cuda and vulkan requires
that multiplane be disabled.

The existing option for this is not sufficient, because when deriving
devices it is not possible to specify any options.

And, it is necessary to derive the Vulkan device, because any pipeline
that involves uploading from cuda to vulkan and then back to cuda must
use the same cuda context on both sides, and the only way to propagate
the cuda context all the way through is to derive the device at each
stage.

ie:

-vf hwupload=derive_device=vulkan,,hwupload=derive_device=cuda

Signed-off-by: Philip Langdale 
---
 libavutil/hwcontext_vulkan.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index e8241638d9..2c594317f9 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1589,6 +1589,11 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx,
 
 dev_select.has_uuid = 1;
 
+/*
+ * CUDA is not able to import multiplane images, so always derive a
+ * Vulkan device with multiplane disabled.
+ */
+av_dict_set(&opts, "disable_multiplane", "1", 0);
 return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
 }
 #endif
-- 
2.39.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v11 1/6] avformat/flvenc: support mux hevc in enhanced flv

2023-06-02 Thread Steven Liu
Lance Wang  于2023年6月2日周五 23:52写道:
>
> On Fri, Jun 2, 2023 at 7:29 PM Steven Liu  wrote:
>
> > Lance Wang  于2023年6月2日周五 19:09写道:
> > >
> > > On Fri, Jun 2, 2023 at 3:31 PM Steven Liu  wrote:
> > >
> > > > Signed-off-by: Steven Liu 
> > > > ---
> > > >  libavformat/Makefile |  2 +-
> > > >  libavformat/flv.h| 15 +++
> > > >  libavformat/flvenc.c | 41 +++--
> > > >  3 files changed, 47 insertions(+), 11 deletions(-)
> > > >
> > > > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > > > index f8ad7c6a11..1ef3d15467 100644
> > > > --- a/libavformat/Makefile
> > > > +++ b/libavformat/Makefile
> > > > @@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+=
> > flacenc.o
> > > > flacenc_header.o \
> > > >  OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
> > > >  OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
> > > >  OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
> > > > -OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o
> > > > +OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o
> > > >  OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
> > > >  OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
> > > >  OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
> > > > diff --git a/libavformat/flv.h b/libavformat/flv.h
> > > > index 3571b90279..91e0a4140c 100644
> > > > --- a/libavformat/flv.h
> > > > +++ b/libavformat/flv.h
> > > > @@ -35,6 +35,12 @@
> > > >
> > > >  #define FLV_VIDEO_FRAMETYPE_OFFSET   4
> > > >
> > > > +/* Extended VideoTagHeader
> > > > + * defined in reference link:
> > > > + *
> > > >
> > https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
> > > > + * */
> > > > +#define FLV_IS_EX_HEADER  0x80
> > > > +
> > > >  /* bitmasks to isolate specific values */
> > > >  #define FLV_AUDIO_CHANNEL_MASK0x01
> > > >  #define FLV_AUDIO_SAMPLESIZE_MASK 0x02
> > > > @@ -112,6 +118,15 @@ enum {
> > > >  FLV_CODECID_MPEG4   = 9,
> > > >  };
> > > >
> > > > +enum {
> > > > +PacketTypeSequenceStart = 0,
> > > > +PacketTypeCodedFrames   = 1,
> > > > +PacketTypeSequenceEnd   = 2,
> > > > +PacketTypeCodedFramesX  = 3,
> > > > +PacketTypeMetadata  = 4,
> > > > +PacketTypeMPEG2TSSequenceStart  = 5,
> > > > +};
> > > > +
> > > >
> > >
> > > format and align the "="?
> > yes it is aligned in patch, you can reference in
> >
> > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20230602073109.14086-2...@chinaffmpeg.org/
> > >
> > >
> > >
> > > >  enum {
> > > >  FLV_FRAME_KEY= 1 << FLV_VIDEO_FRAMETYPE_OFFSET, ///<
> > key
> > > > frame (for AVC, a seekable frame)
> > > >  FLV_FRAME_INTER  = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, ///<
> > > > inter frame (for AVC, a non-seekable frame)
> > > > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > > > index 721f062811..aed0946a2e 100644
> > > > --- a/libavformat/flvenc.c
> > > > +++ b/libavformat/flvenc.c
> > > > @@ -28,6 +28,7 @@
> > > >  #include "libavcodec/mpeg4audio.h"
> > > >  #include "avio.h"
> > > >  #include "avc.h"
> > > > +#include "hevc.h"
> > > >  #include "avformat.h"
> > > >  #include "flv.h"
> > > >  #include "internal.h"
> > > > @@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
> > > >  { AV_CODEC_ID_VP6,  FLV_CODECID_VP6 },
> > > >  { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A },
> > > >  { AV_CODEC_ID_H264, FLV_CODECID_H264 },
> > > > +{ AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
> > > >  { AV_CODEC_ID_NONE, 0 }
> > > >  };
> > > >
> > > > @@ -489,7 +491,7 @@ static void
> > flv_write_codec_header(AVFormatContext* s,
> > > > AVCodecParameters* par, i
> > > >  FLVContext *flv = s->priv_data;
> > > >
> > > >  if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id ==
> > > > AV_CODEC_ID_H264
> > > > -|| par->codec_id == AV_CODEC_ID_MPEG4) {
> > > > +|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id ==
> > > > AV_CODEC_ID_HEVC) {
> > > >  int64_t pos;
> > > >  avio_w8(pb,
> > > >  par->codec_type == AVMEDIA_TYPE_VIDEO ?
> > > > @@ -532,10 +534,19 @@ static void
> > flv_write_codec_header(AVFormatContext*
> > > > s, AVCodecParameters* par, i
> > > >  }
> > > >  avio_write(pb, par->extradata, par->extradata_size);
> > > >  } else {
> > > > -avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
> > > > -avio_w8(pb, 0); // AVC sequence header
> > > > -avio_wb24(pb, 0); // composition time
> > > > -ff_isom_write_avcc(pb, par->extradata,
> > par->extradata_size);
> > > > +if (par->codec_id == AV_CODEC_ID_HEVC) {
> > > > +avio_w8(pb, FLV_IS_EX_HEADER |
> > PacketTypeSequenceStart |
> > > > FLV_FRAME_KEY); // ExVideoTagHeader mode with PacketTypeSequenceStart
> > > > +  

[FFmpeg-devel] [PATCH] V2: avutil/hwcontext_vulkan: disable multiplane when deriving from cuda

2023-06-02 Thread Philip Langdale
Today, cuda is not able to import multiplane images, and cuda requires
images to be imported whether you trying to import to cuda or export
from cuda (in the later case, the image is imported and then copied
into on the cuda side). So any interop between cuda and vulkan requires
that multiplane be disabled.

The existing option for this is not sufficient, because when deriving
devices it is not possible to specify any options.

And, it is necessary to derive the Vulkan device, because any pipeline
that involves uploading from cuda to vulkan and then back to cuda must
use the same cuda context on both sides, and the only way to propagate
the cuda context all the way through is to derive the device at each
stage.

ie:

-vf hwupload=derive_device=vulkan,,hwupload=derive_device=cuda

Signed-off-by: Philip Langdale 
---
 libavutil/hwcontext_vulkan.c | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index e8241638d9..ec084d94d7 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1180,6 +1180,7 @@ static void vulkan_device_free(AVHWDeviceContext *ctx)
 
 static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
  VulkanDeviceSelection *dev_select,
+ int disable_multiplane,
  AVDictionary *opts, int flags)
 {
 int err = 0;
@@ -1335,9 +1336,15 @@ static int 
vulkan_device_create_internal(AVHWDeviceContext *ctx,
 if (opt_d)
 p->use_linear_images = strtol(opt_d->value, NULL, 10);
 
-opt_d = av_dict_get(opts, "disable_multiplane", NULL, 0);
-if (opt_d)
-p->disable_multiplane = strtol(opt_d->value, NULL, 10);
+/*
+ * The disable_multiplane argument takes precedent over the option.
+ */
+p->disable_multiplane = disable_multiplane;
+if (!p->disable_multiplane) {
+opt_d = av_dict_get(opts, "disable_multiplane", NULL, 0);
+if (opt_d)
+p->disable_multiplane = strtol(opt_d->value, NULL, 10);
+}
 
 hwctx->enabled_dev_extensions = dev_info.ppEnabledExtensionNames;
 hwctx->nb_enabled_dev_extensions = dev_info.enabledExtensionCount;
@@ -1511,7 +1518,7 @@ static int vulkan_device_create(AVHWDeviceContext *ctx, 
const char *device,
 }
 }
 
-return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
+return vulkan_device_create_internal(ctx, &dev_select, 0, opts, flags);
 }
 
 static int vulkan_device_derive(AVHWDeviceContext *ctx,
@@ -1537,7 +1544,7 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx,
 if (strstr(vendor, "AMD"))
 dev_select.vendor_id = 0x1002;
 
-return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
+return vulkan_device_create_internal(ctx, &dev_select, 0, opts, flags);
 }
 #endif
 #if CONFIG_LIBDRM
@@ -1570,7 +1577,7 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx,
 
 drmFreeDevice(&drm_dev_info);
 
-return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
+return vulkan_device_create_internal(ctx, &dev_select, 0, opts, flags);
 }
 #endif
 #if CONFIG_CUDA
@@ -1589,7 +1596,11 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx,
 
 dev_select.has_uuid = 1;
 
-return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
+/*
+ * CUDA is not able to import multiplane images, so always derive a
+ * Vulkan device with multiplane disabled.
+ */
+return vulkan_device_create_internal(ctx, &dev_select, 1, opts, flags);
 }
 #endif
 default:
-- 
2.39.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".