[FFmpeg-cvslog] avformat/mvi: Check audio_data_size to be non negative

2021-04-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Apr 10 22:55:00 2021 +0200| [7e241a1b73bcca768f48ff1851e9e9f3f0752000] | 
committer: Michael Niedermayer

avformat/mvi: Check audio_data_size to be non negative

Fixes: left shift of negative value -224
Fixes: 
32144/clusterfuzz-testcase-minimized-ffmpeg_dem_MVI_fuzzer-4971479323246592

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e241a1b73bcca768f48ff1851e9e9f3f0752000
---

 libavformat/mvi.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index cfdbe5d273..d005001f5a 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -32,7 +32,6 @@
 
 typedef struct MviDemuxContext {
 unsigned int (*get_int)(AVIOContext *);
-uint32_t audio_data_size;
 uint64_t audio_size_counter;
 uint64_t audio_frame_size;
 int audio_size_left;
@@ -46,6 +45,7 @@ static int read_header(AVFormatContext *s)
 AVStream *ast, *vst;
 unsigned int version, frames_count, msecs_per_frame, player_version;
 int ret;
+int audio_data_size;
 
 ast = avformat_new_stream(s, NULL);
 if (!ast)
@@ -67,13 +67,13 @@ static int read_header(AVFormatContext *s)
 vst->codecpar->height   = avio_rl16(pb);
 avio_r8(pb);
 ast->codecpar->sample_rate  = avio_rl16(pb);
-mvi->audio_data_size = avio_rl32(pb);
+audio_data_size = avio_rl32(pb);
 avio_r8(pb);
 player_version   = avio_rl32(pb);
 avio_rl16(pb);
 avio_r8(pb);
 
-if (frames_count == 0 || mvi->audio_data_size == 0)
+if (frames_count == 0 || audio_data_size <= 0)
 return AVERROR_INVALIDDATA;
 
 if (version != 7 || player_version > 213) {
@@ -96,16 +96,16 @@ static int read_header(AVFormatContext *s)
 
 mvi->get_int = (vst->codecpar->width * (int64_t)vst->codecpar->height < (1 
<< 16)) ? avio_rl16 : avio_rl24;
 
-mvi->audio_frame_size   = ((uint64_t)mvi->audio_data_size << 
MVI_FRAC_BITS) / frames_count;
+mvi->audio_frame_size   = ((uint64_t)audio_data_size << MVI_FRAC_BITS) / 
frames_count;
 if (mvi->audio_frame_size <= 1 << MVI_FRAC_BITS - 1) {
 av_log(s, AV_LOG_ERROR,
-   "Invalid audio_data_size (%"PRIu32") or frames_count (%u)\n",
-   mvi->audio_data_size, frames_count);
+   "Invalid audio_data_size (%d) or frames_count (%u)\n",
+   audio_data_size, frames_count);
 return AVERROR_INVALIDDATA;
 }
 
 mvi->audio_size_counter = (ast->codecpar->sample_rate * 830 / 
mvi->audio_frame_size - 1) * mvi->audio_frame_size;
-mvi->audio_size_left= mvi->audio_data_size;
+mvi->audio_size_left= audio_data_size;
 
 return 0;
 }

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

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

[FFmpeg-cvslog] lavfi/qsvvpp: support async depth

2021-04-11 Thread Fei Wang
ffmpeg | branch: master | Fei Wang  | Wed Mar 31 10:07:44 
2021 +0800| [89ffcd1bbe1150aa07ae52a4e1545668a4e83a3e] | committer: Zhong Li

lavfi/qsvvpp: support async depth

Async depth will allow qsv filter cache few frames, and avoid force
switch and end filter task frame by frame. This change will improve
performance for some multi-task case, for example 1:N transcode(
decode + vpp + encode) with all QSV plugins.

Performance data test on my Coffee Lake Desktop(i7-8700K) by using
the following 1:8 transcode test case improvement:
1. Fps improved from 55 to 130.
2. Render/Video usage improved from ~61%/~38% to ~100%/~70%.(Data get
from intel_gpu_top)

test CMD:
ffmpeg -v verbose -init_hw_device qsv=hw:/dev/dri/renderD128 -filter_hw_device  
   \
 hw -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i 1920x1080.264  
   \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 
-refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 
-refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 
-refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 
-refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 
-refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 
-refs 2 -bf 3 -q 24 -f null - \
-vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 
-refs 2 -bf 3 -q 24 -f null -

Signed-off-by: Fei Wang 
Reviewed-by: Linjie Fu 
Signed-off-by: Zhong Li 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89ffcd1bbe1150aa07ae52a4e1545668a4e83a3e
---

 libavfilter/qsvvpp.c | 153 +++
 libavfilter/qsvvpp.h |  39 +-
 libavfilter/vf_deinterlace_qsv.c |  14 +---
 libavfilter/vf_vpp_qsv.c |  75 +++
 4 files changed, 191 insertions(+), 90 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index f216b3f248..4768f6208b 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -37,37 +37,6 @@
 #define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME)
 #define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
 
-typedef struct QSVFrame {
-AVFrame  *frame;
-mfxFrameSurface1 *surface;
-mfxFrameSurface1  surface_internal;  /* for system memory */
-struct QSVFrame  *next;
-} QSVFrame;
-
-/* abstract struct for all QSV filters */
-struct QSVVPPContext {
-mfxSession  session;
-int (*filter_frame) (AVFilterLink *outlink, AVFrame *frame);/* callback */
-enum AVPixelFormat  out_sw_format;   /* Real output format */
-mfxVideoParam   vpp_param;
-mfxFrameInfo   *frame_infos; /* frame info for each input */
-
-/* members related to the input/output surface */
-int in_mem_mode;
-int out_mem_mode;
-QSVFrame   *in_frame_list;
-QSVFrame   *out_frame_list;
-int nb_surface_ptrs_in;
-int nb_surface_ptrs_out;
-mfxFrameSurface1  **surface_ptrs_in;
-mfxFrameSurface1  **surface_ptrs_out;
-
-/* MFXVPP extern parameters */
-mfxExtOpaqueSurfaceAlloc opaque_alloc;
-mfxExtBuffer  **ext_buffers;
-int nb_ext_buffers;
-};
-
 static const mfxHandleType handle_types[] = {
 MFX_HANDLE_VA_DISPLAY,
 MFX_HANDLE_D3D9_DEVICE_MANAGER,
@@ -336,9 +305,11 @@ static int fill_frameinfo_by_link(mfxFrameInfo *frameinfo, 
AVFilterLink *link)
 static void clear_unused_frames(QSVFrame *list)
 {
 while (list) {
-if (list->surface && !list->surface->Data.Locked) {
-list->surface = NULL;
+/* list->queued==1 means the frame is not cached in VPP
+ * process any more, it can be released to pool. */
+if ((list->queued == 1) && !list->surface.Data.Locked) {
 av_frame_free(>frame);
+list->queued = 0;
 }
 list = list->next;
 }
@@ -361,8 +332,10 @@ static QSVFrame *get_free_frame(QSVFrame **list)
 QSVFrame *out = *list;
 
 for (; out; out = out->next) {
-if (!out->surface)
+if (!out->queued) {
+out->queued = 1;
 break;
+}
 }
 
 if (!out) {
@@ -371,8 +344,9 @@ static QSVFrame *get_free_frame(QSVFrame **list)
 av_log(NULL, AV_LOG_ERROR, "Can't alloc new output frame.\n");
 return NULL;
 }
-out->next  = *list;
-*list  = out;
+out->queued = 1;
+out->next   = *list;
+*list   = out;
 }
 
 return out;
@@ -402,7 +376,7 @@ static QSVFrame *submit_frame(QSVVPPContext *s, 
AVFilterLink *inlink, AVFrame *p
 return NULL;
 }
 

[FFmpeg-cvslog] avformat/rawenc: perform stream checks for mp2 muxer

2021-04-11 Thread Gyan Doshi
ffmpeg | branch: master | Gyan Doshi  | Sun Apr 11 11:13:57 
2021 +0530| [309e3cc15c87234861fe127614e09023f3867523] | committer: Gyan Doshi

avformat/rawenc: perform stream checks for mp2 muxer

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=309e3cc15c87234861fe127614e09023f3867523
---

 libavformat/rawenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index caec297f4a..0802d9a831 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -433,6 +433,7 @@ AVOutputFormat ff_mp2_muxer = {
 .extensions= "mp2,m2a,mpa",
 .audio_codec   = AV_CODEC_ID_MP2,
 .video_codec   = AV_CODEC_ID_NONE,
+.init  = force_one_stream,
 .write_packet  = ff_raw_write_packet,
 .flags = AVFMT_NOTIMESTAMPS,
 };

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

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

[FFmpeg-cvslog] avformat/img2dec: set r_frame_rate in addition to avg_frame_rate

2021-04-11 Thread Jan Ekström
ffmpeg | branch: master | Jan Ekström  | Wed Apr  7 21:17:04 
2021 +0300| [5945288818b98682884888e3800893b2f2ac7507] | committer: Jan Ekström

avformat/img2dec: set r_frame_rate in addition to avg_frame_rate

Apparently for various image sequences libavformat/utils.c can
calculate rather fancy r_frame_rate values, such as `186/1921`,
and since ffmpeg.c utilizes r_frame_rate for the filter chain
time base, this can quite deteriorate the output frame timing - even
though the user has requested the image sequence to be interpreted
at a specific, constant frame rate.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5945288818b98682884888e3800893b2f2ac7507
---

 libavformat/img2dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index be7149bb2f..7b03cb2af1 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -222,7 +222,7 @@ int ff_img_read_header(AVFormatContext *s1)
 avpriv_set_pts_info(st, 64, 1, 1);
 else {
 avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num);
-st->avg_frame_rate = s->framerate;
+st->avg_frame_rate = st->r_frame_rate = s->framerate;
 }
 
 if (s->width && s->height) {

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

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

[FFmpeg-cvslog] avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: release/4.3 | Timo Rothenpieler  | Sat 
Apr 10 14:31:52 2021 +0200| [0fcaa9773943843c26ceb950ef2075d92f59bc21] | 
committer: Timo Rothenpieler

avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0fcaa9773943843c26ceb950ef2075d92f59bc21
---

 libavfilter/vf_overlay_cuda.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index f6ee43e929..e45f510644 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -63,6 +63,7 @@ typedef struct OverlayCUDAContext {
 enum AVPixelFormat in_format_overlay;
 enum AVPixelFormat in_format_main;
 
+AVBufferRef *hw_device_ctx;
 AVCUDADeviceContext *hwctx;
 
 CUcontext cu_ctx;
@@ -256,6 +257,9 @@ static av_cold void overlay_cuda_uninit(AVFilterContext 
*avctx)
 CHECK_CU(cu->cuModuleUnload(ctx->cu_module));
 CHECK_CU(cu->cuCtxPopCurrent());
 }
+
+av_buffer_unref(>hw_device_ctx);
+ctx->hwctx = NULL;
 }
 
 /**
@@ -341,7 +345,9 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 
 // initialize
 
-ctx->hwctx = frames_ctx->device_ctx->hwctx;
+ctx->hw_device_ctx = av_buffer_ref(frames_ctx->device_ref);
+ctx->hwctx = ((AVHWDeviceContext*)ctx->hw_device_ctx->data)->hwctx;
+
 cuda_ctx = ctx->hwctx->cuda_ctx;
 ctx->fs.time_base = inlink->time_base;
 

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

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

[FFmpeg-cvslog] avfilter/overlay_cuda: check av_buffer_ref result

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: release/4.3 | Timo Rothenpieler  | Sun 
Apr 11 10:15:47 2021 +0200| [85713d85a70a534e8906a574c68af37a1f7053d9] | 
committer: Timo Rothenpieler

avfilter/overlay_cuda: check av_buffer_ref result

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85713d85a70a534e8906a574c68af37a1f7053d9
---

 libavfilter/vf_overlay_cuda.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index e45f510644..34241c8e1b 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -346,6 +346,8 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 // initialize
 
 ctx->hw_device_ctx = av_buffer_ref(frames_ctx->device_ref);
+if (!ctx->hw_device_ctx)
+return AVERROR(ENOMEM);
 ctx->hwctx = ((AVHWDeviceContext*)ctx->hw_device_ctx->data)->hwctx;
 
 cuda_ctx = ctx->hwctx->cuda_ctx;
@@ -354,6 +356,8 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 ctx->cu_stream = ctx->hwctx->stream;
 
 outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx);
+if (!outlink->hw_frames_ctx)
+return AVERROR(ENOMEM);
 
 // load functions
 

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

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

[FFmpeg-cvslog] avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: release/4.4 | Timo Rothenpieler  | Sat 
Apr 10 14:31:52 2021 +0200| [5873e06460856a8cb5da25a4f72e86e1d861c586] | 
committer: Timo Rothenpieler

avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5873e06460856a8cb5da25a4f72e86e1d861c586
---

 libavfilter/vf_overlay_cuda.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index f6ee43e929..e45f510644 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -63,6 +63,7 @@ typedef struct OverlayCUDAContext {
 enum AVPixelFormat in_format_overlay;
 enum AVPixelFormat in_format_main;
 
+AVBufferRef *hw_device_ctx;
 AVCUDADeviceContext *hwctx;
 
 CUcontext cu_ctx;
@@ -256,6 +257,9 @@ static av_cold void overlay_cuda_uninit(AVFilterContext 
*avctx)
 CHECK_CU(cu->cuModuleUnload(ctx->cu_module));
 CHECK_CU(cu->cuCtxPopCurrent());
 }
+
+av_buffer_unref(>hw_device_ctx);
+ctx->hwctx = NULL;
 }
 
 /**
@@ -341,7 +345,9 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 
 // initialize
 
-ctx->hwctx = frames_ctx->device_ctx->hwctx;
+ctx->hw_device_ctx = av_buffer_ref(frames_ctx->device_ref);
+ctx->hwctx = ((AVHWDeviceContext*)ctx->hw_device_ctx->data)->hwctx;
+
 cuda_ctx = ctx->hwctx->cuda_ctx;
 ctx->fs.time_base = inlink->time_base;
 

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

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

[FFmpeg-cvslog] avfilter/overlay_cuda: check av_buffer_ref result

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: release/4.4 | Timo Rothenpieler  | Sun 
Apr 11 10:15:47 2021 +0200| [acb339bb88ca1a52ef4edb3a5f3df24ed05be82d] | 
committer: Timo Rothenpieler

avfilter/overlay_cuda: check av_buffer_ref result

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=acb339bb88ca1a52ef4edb3a5f3df24ed05be82d
---

 libavfilter/vf_overlay_cuda.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index e45f510644..34241c8e1b 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -346,6 +346,8 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 // initialize
 
 ctx->hw_device_ctx = av_buffer_ref(frames_ctx->device_ref);
+if (!ctx->hw_device_ctx)
+return AVERROR(ENOMEM);
 ctx->hwctx = ((AVHWDeviceContext*)ctx->hw_device_ctx->data)->hwctx;
 
 cuda_ctx = ctx->hwctx->cuda_ctx;
@@ -354,6 +356,8 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 ctx->cu_stream = ctx->hwctx->stream;
 
 outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx);
+if (!outlink->hw_frames_ctx)
+return AVERROR(ENOMEM);
 
 // load functions
 

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

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

[FFmpeg-cvslog] avfilter/overlay_cuda: check av_buffer_ref result

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Sun Apr 
11 10:15:47 2021 +0200| [ef16dcc6a9240644d8e06528c19710783b7c6adf] | committer: 
Timo Rothenpieler

avfilter/overlay_cuda: check av_buffer_ref result

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ef16dcc6a9240644d8e06528c19710783b7c6adf
---

 libavfilter/vf_overlay_cuda.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index e45f510644..34241c8e1b 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -346,6 +346,8 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 // initialize
 
 ctx->hw_device_ctx = av_buffer_ref(frames_ctx->device_ref);
+if (!ctx->hw_device_ctx)
+return AVERROR(ENOMEM);
 ctx->hwctx = ((AVHWDeviceContext*)ctx->hw_device_ctx->data)->hwctx;
 
 cuda_ctx = ctx->hwctx->cuda_ctx;
@@ -354,6 +356,8 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 ctx->cu_stream = ctx->hwctx->stream;
 
 outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx);
+if (!outlink->hw_frames_ctx)
+return AVERROR(ENOMEM);
 
 // load functions
 

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

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

[FFmpeg-cvslog] avfilter/vf_v360: unbreak fov_from_dfov() for (d)fisheye when width != height

2021-04-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 11 10:09:48 
2021 +0200| [e917cd9828f63aba27a5647c012d62a85bf0c977] | committer: Paul B Mahol

avfilter/vf_v360: unbreak fov_from_dfov() for (d)fisheye when width != height

Based on patch by Daniel Playfair Cal.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e917cd9828f63aba27a5647c012d62a85bf0c977
---

 libavfilter/vf_v360.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 87105dbe92..053ea8868e 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -4078,18 +4078,18 @@ static void fov_from_dfov(int format, float d_fov, 
float w, float h, float *h_fo
 break;
 case DUAL_FISHEYE:
 {
-const float d = 0.5f * hypotf(w * 0.5f, h);
+const float d = hypotf(w * 0.5f, h);
 
-*h_fov = d / w * 2.f * d_fov;
-*v_fov = d / h * d_fov;
+*h_fov = 0.5f * w / d * d_fov;
+*v_fov =h / d * d_fov;
 }
 break;
 case FISHEYE:
 {
-const float d = 0.5f * hypotf(w, h);
+const float d = hypotf(w, h);
 
-*h_fov = d / w * d_fov;
-*v_fov = d / h * d_fov;
+*h_fov = w / d * d_fov;
+*v_fov = h / d * d_fov;
 }
 break;
 case FLAT:

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

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

[FFmpeg-cvslog] avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Sat Apr 
10 14:31:52 2021 +0200| [5d52c4cbba8daee4c6f752087c1a01ddc9c43eac] | committer: 
Timo Rothenpieler

avfilter/overlay_cuda: hold explicit reference to hw_device_ctx

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d52c4cbba8daee4c6f752087c1a01ddc9c43eac
---

 libavfilter/vf_overlay_cuda.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index f6ee43e929..e45f510644 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -63,6 +63,7 @@ typedef struct OverlayCUDAContext {
 enum AVPixelFormat in_format_overlay;
 enum AVPixelFormat in_format_main;
 
+AVBufferRef *hw_device_ctx;
 AVCUDADeviceContext *hwctx;
 
 CUcontext cu_ctx;
@@ -256,6 +257,9 @@ static av_cold void overlay_cuda_uninit(AVFilterContext 
*avctx)
 CHECK_CU(cu->cuModuleUnload(ctx->cu_module));
 CHECK_CU(cu->cuCtxPopCurrent());
 }
+
+av_buffer_unref(>hw_device_ctx);
+ctx->hwctx = NULL;
 }
 
 /**
@@ -341,7 +345,9 @@ static int overlay_cuda_config_output(AVFilterLink *outlink)
 
 // initialize
 
-ctx->hwctx = frames_ctx->device_ctx->hwctx;
+ctx->hw_device_ctx = av_buffer_ref(frames_ctx->device_ref);
+ctx->hwctx = ((AVHWDeviceContext*)ctx->hw_device_ctx->data)->hwctx;
+
 cuda_ctx = ctx->hwctx->cuda_ctx;
 ctx->fs.time_base = inlink->time_base;
 

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

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

[FFmpeg-cvslog] avcodec/nvenc: add support for gbrp rgb input

2021-04-11 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Tue Mar 
30 22:08:49 2021 +0200| [7555d6f74ce4845383e9297fd0989059739af4c2] | committer: 
Timo Rothenpieler

avcodec/nvenc: add support for gbrp rgb input

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7555d6f74ce4845383e9297fd0989059739af4c2
---

 libavcodec/nvenc.c   | 30 --
 libavcodec/version.h |  2 +-
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index dddee8cac1..60006dc88f 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -52,6 +52,8 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
 AV_PIX_FMT_YUV444P16, // Truncated to 10bits
 AV_PIX_FMT_0RGB32,
 AV_PIX_FMT_0BGR32,
+AV_PIX_FMT_GBRP,
+AV_PIX_FMT_GBRP16,// Truncated to 10bits
 AV_PIX_FMT_CUDA,
 #if CONFIG_D3D11VA
 AV_PIX_FMT_D3D11,
@@ -69,12 +71,18 @@ const AVCodecHWConfigInternal *const ff_nvenc_hw_configs[] 
= {
 NULL,
 };
 
-#define IS_10BIT(pix_fmt)  (pix_fmt == AV_PIX_FMT_P010|| \
-pix_fmt == AV_PIX_FMT_P016|| \
-pix_fmt == AV_PIX_FMT_YUV444P16)
+#define IS_10BIT(pix_fmt)  (pix_fmt == AV_PIX_FMT_P010  || \
+pix_fmt == AV_PIX_FMT_P016  || \
+pix_fmt == AV_PIX_FMT_YUV444P16 || \
+pix_fmt == AV_PIX_FMT_GBRP16)
 
-#define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P || \
-pix_fmt == AV_PIX_FMT_YUV444P16)
+#define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P   || \
+pix_fmt == AV_PIX_FMT_YUV444P16 || \
+pix_fmt == AV_PIX_FMT_GBRP  || \
+pix_fmt == AV_PIX_FMT_GBRP16)
+
+#define IS_GBRP(pix_fmt) (pix_fmt == AV_PIX_FMT_GBRP || \
+  pix_fmt == AV_PIX_FMT_GBRP16)
 
 static const struct {
 NVENCSTATUS nverr;
@@ -1028,14 +1036,14 @@ static av_cold int 
nvenc_setup_h264_config(AVCodecContext *avctx)
 NV_ENC_CONFIG_H264 *h264   = >encodeCodecConfig.h264Config;
 NV_ENC_CONFIG_H264_VUI_PARAMETERS *vui = >h264VUIParameters;
 
-vui->colourMatrix = avctx->colorspace;
+vui->colourMatrix = IS_GBRP(ctx->data_pix_fmt) ? AVCOL_SPC_RGB : 
avctx->colorspace;
 vui->colourPrimaries = avctx->color_primaries;
 vui->transferCharacteristics = avctx->color_trc;
 vui->videoFullRangeFlag = (avctx->color_range == AVCOL_RANGE_JPEG
 || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ420P || ctx->data_pix_fmt == 
AV_PIX_FMT_YUVJ422P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ444P);
 
 vui->colourDescriptionPresentFlag =
-(avctx->colorspace != 2 || avctx->color_primaries != 2 || 
avctx->color_trc != 2);
+(vui->colourMatrix != 2 || vui->colourPrimaries != 2 || 
vui->transferCharacteristics != 2);
 
 vui->videoSignalTypePresentFlag =
 (vui->colourDescriptionPresentFlag
@@ -1094,7 +1102,7 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext 
*avctx)
 }
 
 // force setting profile as high444p if input is AV_PIX_FMT_YUV444P
-if (ctx->data_pix_fmt == AV_PIX_FMT_YUV444P) {
+if (IS_YUV444(ctx->data_pix_fmt)) {
 cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_444_GUID;
 avctx->profile = FF_PROFILE_H264_HIGH_444_PREDICTIVE;
 }
@@ -1125,14 +1133,14 @@ static av_cold int 
nvenc_setup_hevc_config(AVCodecContext *avctx)
 NV_ENC_CONFIG_HEVC *hevc   = >encodeCodecConfig.hevcConfig;
 NV_ENC_CONFIG_HEVC_VUI_PARAMETERS *vui = >hevcVUIParameters;
 
-vui->colourMatrix = avctx->colorspace;
+vui->colourMatrix = IS_GBRP(ctx->data_pix_fmt) ? AVCOL_SPC_RGB : 
avctx->colorspace;
 vui->colourPrimaries = avctx->color_primaries;
 vui->transferCharacteristics = avctx->color_trc;
 vui->videoFullRangeFlag = (avctx->color_range == AVCOL_RANGE_JPEG
 || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ420P || ctx->data_pix_fmt == 
AV_PIX_FMT_YUVJ422P || ctx->data_pix_fmt == AV_PIX_FMT_YUVJ444P);
 
 vui->colourDescriptionPresentFlag =
-(avctx->colorspace != 2 || avctx->color_primaries != 2 || 
avctx->color_trc != 2);
+(vui->colourMatrix != 2 || vui->colourPrimaries != 2 || 
vui->transferCharacteristics != 2);
 
 vui->videoSignalTypePresentFlag =
 (vui->colourDescriptionPresentFlag
@@ -1406,8 +1414,10 @@ static NV_ENC_BUFFER_FORMAT nvenc_map_buffer_format(enum 
AVPixelFormat pix_fmt)
 case AV_PIX_FMT_P010:
 case AV_PIX_FMT_P016:
 return NV_ENC_BUFFER_FORMAT_YUV420_10BIT;
+case AV_PIX_FMT_GBRP:
 case AV_PIX_FMT_YUV444P:
 return NV_ENC_BUFFER_FORMAT_YUV444_PL;
+case AV_PIX_FMT_GBRP16:
 case AV_PIX_FMT_YUV444P16:
 return NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
 case AV_PIX_FMT_0RGB32:
diff --git a/libavcodec/version.h b/libavcodec/version.h
index cc09e01e3f..349b4b1269 100644
--- a/libavcodec/version.h
+++ 

[FFmpeg-cvslog] doc/muxers: add entries for raw muxers

2021-04-11 Thread Gyan Doshi
ffmpeg | branch: master | Gyan Doshi  | Sat Apr 10 16:35:53 
2021 +0530| [47b8871ca6f9da4c0467466a43d204dec7fcbd4a] | committer: Gyan Doshi

doc/muxers: add entries for raw muxers

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47b8871ca6f9da4c0467466a43d204dec7fcbd4a
---

 doc/muxers.texi | 172 
 1 file changed, 172 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 5826d7e986..9c5f0a93a9 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1969,6 +1969,178 @@ ogg files can be safely chained.
 
 @end table
 
+@anchor{raw muxers}
+@section raw muxers
+
+Raw muxers accept a single stream matching the designated codec. They do not 
store timestamps or metadata.
+The recognized extension is the same as the muxer name unless indicated 
otherwise.
+
+@subsection ac3
+
+Dolby Digital, also known as AC-3, audio.
+
+@subsection adx
+
+CRI Middleware ADX audio.
+
+This muxer will write out the total sample count near the start of the first 
packet
+when the output is seekable and the count can be stored in 32 bits.
+
+@subsection aptx
+
+aptX (Audio Processing Technology for Bluetooth) audio.
+
+@subsection aptx_hd
+
+aptX HD (Audio Processing Technology for Bluetooth) audio.
+
+Extensions: aptxhd
+
+@subsection avs2
+
+AVS2-P2/IEEE1857.4 video.
+
+Extensions: avs, avs2
+
+@subsection cavsvideo
+
+Chinese AVS (Audio Video Standard) video.
+
+Extensions: cavs
+
+@subsection codec2raw
+
+Codec 2 audio.
+
+No extension is registered so format name has to be supplied e.g. with the 
ffmpeg CLI tool @code{-f codec2raw}.
+
+@subsection data
+
+Data muxer accepts a single stream with any codec of any type.
+The input stream has to be selected using the @code {-map} option with the 
ffmpeg CLI tool.
+
+No extension is registered so format name has to be supplied e.g. with the 
ffmpeg CLI tool @code{-f data}.
+
+@subsection dirac
+
+BBC Dirac video. The Dirac Pro codec is a subset and is standardized as SMPTE 
VC-2.
+
+Extensions: drc, vc2
+
+@subsection dnxhd
+
+Avid DNxHD video. It is standardized as SMPTE VC-3. Accepts DNxHR streams.
+
+Extensions: dnxhd, dnxhr
+
+@subsection dts
+
+DTS Coherent Acoustics (DCA) audio.
+
+@subsection eac3
+
+Dolby Digital Plus, also known as Enhanced AC-3, audio.
+
+@subsection g722
+
+ITU-T G.722 audio.
+
+@subsection g723_1
+
+ITU-T G.723.1 audio.
+
+Extensions: tco, rco
+
+@subsection g726
+
+ITU-T G.726 big-endian ("left-justified") audio.
+
+No extension is registered so format name has to be supplied e.g. with the 
ffmpeg CLI tool @code{-f g726}.
+
+@subsection g726le
+
+ITU-T G.726 little-endian ("right-justified") audio.
+
+No extension is registered so format name has to be supplied e.g. with the 
ffmpeg CLI tool @code{-f g726le}.
+
+@subsection gsm
+
+Global System for Mobile Communications audio.
+
+@subsection h261
+
+ITU-T H.261 video.
+
+@subsection h263
+
+ITU-T H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2 video.
+
+@subsection h264
+
+ITU-T H.264 / MPEG-4 Part 10 AVC video. Bitstream shall be converted to Annex 
B syntax if it's in length-prefixed mode.
+
+Extensions: h264, 264
+
+@subsection hevc
+
+ITU-T H.265 / MPEG-H Part 2 HEVC video. Bitstream shall be converted to Annex 
B syntax if it's in length-prefixed mode.
+
+Extensions: hevc, h265, 265
+
+@subsection m4v
+
+MPEG-4 Part 2 video.
+
+@subsection mjpeg
+
+Motion JPEG video.
+
+Extensions: mjpg, mjpeg
+
+@subsection mlp
+
+Meridian Lossless Packing, also known as Packed PCM, audio.
+
+@subsection mp2
+
+MPEG-1 Audio Layer II audio.
+
+Extensions: mp2, m2a, mpa
+
+@subsection mpeg1video
+
+MPEG-1 Part 2 video.
+
+Extensions: mpg, mpeg, m1v
+
+@subsection mpeg2video
+
+ITU-T H.262 / MPEG-2 Part 2 video.
+
+Extensions: m2v
+
+@subsection rawvideo
+
+Raw uncompressed video.
+
+Extensions: yuv, rgb
+
+@subsection sbc
+
+Bluetooth SIG low-complexity subband codec audio.
+
+Extensions: sbc, msbc
+
+@subsection truehd
+
+Dolby TrueHD audio.
+
+Extensions: thd
+
+@subsection vc1
+
+SMPTE 421M / VC-1 video.
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 

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

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