[FFmpeg-cvslog] avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD137iL0()

2017-11-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Nov 14 03:40:07 2017 +0100| [73964680d7bce6d81ddc553a24d73e9a1c9156f9] | 
committer: Michael Niedermayer

avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD137iL0()

Fixes: 4035/clusterfuzz-testcase-minimized-6479308925173760
Fixes: runtime error: signed integer overflow: 9 * 402653183 cannot be 
represented in type 'int'

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=73964680d7bce6d81ddc553a24d73e9a1c9156f9
---

 libavcodec/dirac_dwt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dirac_dwt.h b/libavcodec/dirac_dwt.h
index 35ed8857e9..f9a9e9e1b3 100644
--- a/libavcodec/dirac_dwt.h
+++ b/libavcodec/dirac_dwt.h
@@ -102,7 +102,7 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
 (b2 + ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 8) >> 4))
 
 #define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\
-(b2 - ((-b0 + 9*b1 + 9*b3 - b4 + 16) >> 5))
+(b2 - ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 16) >> 5))
 
 #define COMPOSE_HAARiL0(b0, b1)\
 (b0 - ((b1 + 1) >> 1))

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


[FFmpeg-cvslog] Use ff_thread_once for fixed, float table init.

2017-11-18 Thread Dale Curtis
ffmpeg | branch: master | Dale Curtis  | Fri Nov 17 
14:51:09 2017 -0800| [5eaaffaf64d1854493f0fe9ec822eed1b3cd9fe1] | committer: 
Michael Niedermayer

Use ff_thread_once for fixed, float table init.

These tables are static so they should only be initialized once
instead of on every call to ff_mpadsp_init().

Signed-off-by: Dale Curtis 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/mpegaudiodsp.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegaudiodsp.c b/libavcodec/mpegaudiodsp.c
index a5d20df629..3cafca27bf 100644
--- a/libavcodec/mpegaudiodsp.c
+++ b/libavcodec/mpegaudiodsp.c
@@ -20,17 +20,21 @@
 
 #include "config.h"
 #include "libavutil/attributes.h"
+#include "libavutil/thread.h"
 #include "mpegaudiodsp.h"
 #include "dct.h"
 #include "dct32.h"
 
+static AVOnce mpadsp_float_table_init = AV_ONCE_INIT;
+static AVOnce mpadsp_fixed_table_init = AV_ONCE_INIT;
+
 av_cold void ff_mpadsp_init(MPADSPContext *s)
 {
 DCTContext dct;
 
 ff_dct_init(&dct, 5, DCT_II);
-ff_init_mpadsp_tabs_float();
-ff_init_mpadsp_tabs_fixed();
+ff_thread_once(&mpadsp_float_table_init, &ff_init_mpadsp_tabs_float);
+ff_thread_once(&mpadsp_fixed_table_init, &ff_init_mpadsp_tabs_fixed);
 
 s->apply_window_float = ff_mpadsp_apply_window_float;
 s->apply_window_fixed = ff_mpadsp_apply_window_fixed;

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


[FFmpeg-cvslog] avcodec/zmbv: Check that the buffer is large enough for mvec

2017-11-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Nov 15 17:11:12 2017 +0100| [2ab9568a2c3349039eec29fb960fe39de354b514] | 
committer: Michael Niedermayer

avcodec/zmbv: Check that the buffer is large enough for mvec

Fixes: Timeout
Fixes: 4143/clusterfuzz-testcase-4736864637419520

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=2ab9568a2c3349039eec29fb960fe39de354b514
---

 libavcodec/zmbv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index b09dc41ebd..f91d2e3931 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -539,6 +539,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame, AVPac
 } else {
 frame->key_frame = 0;
 frame->pict_type = AV_PICTURE_TYPE_P;
+if (c->decomp_len < 2LL * ((c->width + c->bw - 1) / c->bw) * 
((c->height + c->bh - 1) / c->bh))
+return AVERROR_INVALIDDATA;
 if (c->decomp_len)
 c->decode_xor(c);
 }

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


[FFmpeg-cvslog] Fix leak of frame_duration_buffer in mov_fix_index().

2017-11-18 Thread Dale Curtis
ffmpeg | branch: master | Dale Curtis  | Fri Nov 17 
14:53:25 2017 -0800| [d073be2291e40129d107ca4573097d6d6d2dbf68] | committer: 
Michael Niedermayer

Fix leak of frame_duration_buffer in mov_fix_index().

Should be unconditionally freed at the end of mov_fix_index() in
case it hasn't been used during the fix up.

Signed-off-by: Dale Curtis 
Reviewed-by: Sasi Inguva 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d49d820d2b..3eef043046 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3553,6 +3553,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 // Free the old index and the old CTTS structures
 av_free(e_old);
 av_free(ctts_data_old);
+av_freep(&frame_duration_buffer);
 
 // Null terminate the index ranges array
 current_index_range++;

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


[FFmpeg-cvslog] avcodec/wmv2dec: Check end of bitstream in parse_mb_skip() and ff_wmv2_decode_mb()

2017-11-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Sep 17 01:28:07 2017 +0200| [65e0a7c473f23f1833538ffecf53c81fe500b5e4] | 
committer: Michael Niedermayer

avcodec/wmv2dec: Check end of bitstream in parse_mb_skip() and 
ff_wmv2_decode_mb()

Fixes: Timeout
Fixes: 3200/clusterfuzz-testcase-5750022136135680

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=65e0a7c473f23f1833538ffecf53c81fe500b5e4
---

 libavcodec/wmv2dec.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 261d291c97..ea0e0594b5 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -30,7 +30,7 @@
 #include "wmv2.h"
 
 
-static void parse_mb_skip(Wmv2Context *w)
+static int parse_mb_skip(Wmv2Context *w)
 {
 int mb_x, mb_y;
 MpegEncContext *const s = &w->s;
@@ -45,6 +45,8 @@ static void parse_mb_skip(Wmv2Context *w)
 MB_TYPE_16x16 | MB_TYPE_L0;
 break;
 case SKIP_TYPE_MPEG:
+if (get_bits_left(&s->gb) < s->mb_height * s->mb_width)
+return AVERROR_INVALIDDATA;
 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
 mb_type[mb_y * s->mb_stride + mb_x] =
@@ -52,6 +54,8 @@ static void parse_mb_skip(Wmv2Context *w)
 break;
 case SKIP_TYPE_ROW:
 for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
+if (get_bits_left(&s->gb) < 1)
+return AVERROR_INVALIDDATA;
 if (get_bits1(&s->gb)) {
 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
 mb_type[mb_y * s->mb_stride + mb_x] =
@@ -65,6 +69,8 @@ static void parse_mb_skip(Wmv2Context *w)
 break;
 case SKIP_TYPE_COL:
 for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
+if (get_bits_left(&s->gb) < 1)
+return AVERROR_INVALIDDATA;
 if (get_bits1(&s->gb)) {
 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
 mb_type[mb_y * s->mb_stride + mb_x] =
@@ -77,6 +83,7 @@ static void parse_mb_skip(Wmv2Context *w)
 }
 break;
 }
+return 0;
 }
 
 static int decode_ext_header(Wmv2Context *w)
@@ -170,9 +177,12 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext 
*s)
 }
 } else {
 int cbp_index;
+int ret;
 w->j_type = 0;
 
-parse_mb_skip(w);
+ret = parse_mb_skip(w);
+if (ret < 0)
+return ret;
 cbp_index = decode012(&s->gb);
 w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index);
 
@@ -359,6 +369,8 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t 
block[6][64])
 w->hshift  = 0;
 return 0;
 }
+if (get_bits_left(&s->gb) <= 0)
+return AVERROR_INVALIDDATA;
 
 code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table,
 MB_NON_INTRA_VLC_BITS, 3);
@@ -369,6 +381,8 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t 
block[6][64])
 cbp = code & 0x3f;
 } else {
 s->mb_intra = 1;
+if (get_bits_left(&s->gb) <= 0)
+return AVERROR_INVALIDDATA;
 code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
 if (code < 0) {
 av_log(s->avctx, AV_LOG_ERROR,

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


[FFmpeg-cvslog] lavf/mov: don't read outside frag_index bounds

2017-11-18 Thread John Stebbins
ffmpeg | branch: master | John Stebbins  | Fri Nov 17 
08:21:02 2017 -0800| [20c38f2e7085ce02c19df965d02ecdf5628f11b8] | committer: 
Michael Niedermayer

lavf/mov: don't read outside frag_index bounds

Potentially fixes:
https://bugs.chromium.org/p/chromium/issues/detail?id=786269#c1

In theory, the crash can be triggered by an invalid stream that has
either tfdt or trun outside of the moof

Reviewed-by: Dale Curtis 
Signed-off-by: Michael Niedermayer 

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

 libavformat/mov.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3eef043046..5c9f926bce 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1188,6 +1188,10 @@ static void set_frag_stream(MOVFragmentIndex 
*frag_index, int id)
 static MOVFragmentStreamInfo * get_current_frag_stream_info(
 MOVFragmentIndex *frag_index)
 {
+if (frag_index->current < 0 ||
+frag_index->current >= frag_index->nb_items)
+return NULL;
+
 MOVFragmentIndexItem * item = &frag_index->item[frag_index->current];
 if (item->current >= 0 && item->current < item->nb_stream_info)
 return &item->stream_info[item->current];

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


[FFmpeg-cvslog] Ignore libavcodec/tests/mpeg12framerate, a test program

2017-11-18 Thread Jim DeLaHunt
ffmpeg | branch: master | Jim DeLaHunt  | Fri Nov 17 
01:45:27 2017 -0800| [fb791d28766bdacbb685a77c381101afc98ed58b] | committer: 
Michael Niedermayer

Ignore libavcodec/tests/mpeg12framerate, a test program

Add to libavcodec/tests/.gitignore an entry for test
program libavcodec/tests/mpeg12framerate . Other
similar test programs, e.g. jpeg2000dwt and dct, are
ignored in a similar way.

On initially checking out master, and doing "./configure"
and "make clean", "git status" reports no untracked
files. After running "make fate", "git status" reports
untracked file "libavcodec/tests/mpeg12framerate".

mpeg12framerate is a unit test program. It was apparently
introduced in commit
278c308ceae6b8d7bac1dfc24518821aae603988, on
Tue Sep 12 22:11:56 2017 +0100. It added a new function
ff_mpeg12_find_best_frame_rate() to
libavcodec/mpeg12framerate.c , and the code in
libavcodec/tests/mpeg12framerate.c to exercise that
function. This commit also added the new program to
the FATE suite, but it omitted a .gitignore entry.

Signed-off-by: Michael Niedermayer 

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

 libavcodec/tests/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/tests/.gitignore b/libavcodec/tests/.gitignore
index 7f9e3825b6..350fb2990c 100644
--- a/libavcodec/tests/.gitignore
+++ b/libavcodec/tests/.gitignore
@@ -14,6 +14,7 @@
 /mathops
 /mjpegenc_huffman
 /motion
+/mpeg12framerate
 /options
 /rangecoder
 /snowenc

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


[FFmpeg-cvslog] avcodec/mlpdsp: Fix undefined shift ff_mlp_pack_output()

2017-11-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Nov 15 03:38:37 2017 +0100| [4f7f70738e8dd77a698a5e28bba552ea7064af21] | 
committer: Michael Niedermayer

avcodec/mlpdsp: Fix undefined shift ff_mlp_pack_output()

Fixes: runtime error: left shift of negative value -7862264
Fixes: 4074/clusterfuzz-testcase-minimized-4516104123711488

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=4f7f70738e8dd77a698a5e28bba552ea7064af21
---

 libavcodec/mlpdsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c
index fbafa92d72..4e3a16c781 100644
--- a/libavcodec/mlpdsp.c
+++ b/libavcodec/mlpdsp.c
@@ -117,7 +117,7 @@ int32_t ff_mlp_pack_output(int32_t lossless_check_data,
   (1U << output_shift[mat_ch]);
 lossless_check_data ^= (sample & 0xff) << mat_ch;
 if (is32)
-*data_32++ = sample << 8;
+*data_32++ = sample * 256;
 else
 *data_16++ = sample >> 8;
 }

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


[FFmpeg-cvslog] avcodec: Implement mpeg2 nvdec hwaccel

2017-11-18 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Thu Nov 16 
07:35:17 2017 -0800| [7c9f739d864c0ed8f1b433d6a7d9f674edda9cf5] | committer: 
Philip Langdale

avcodec: Implement mpeg2 nvdec hwaccel

This is mostly straight-forward. The weird part is that it should
just work for mpeg1, but I see corruption in my test cases, so I'm
going to try and fix that separately.

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

 Changelog |   2 +-
 configure |   2 +
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/mpeg12dec.c|   3 +
 libavcodec/nvdec.c|  11 ++--
 libavcodec/nvdec_mpeg12.c | 152 ++
 libavcodec/version.h  |   2 +-
 8 files changed, 167 insertions(+), 7 deletions(-)

diff --git a/Changelog b/Changelog
index 119ab678e5..cda59166fc 100644
--- a/Changelog
+++ b/Changelog
@@ -13,7 +13,7 @@ version :
 - PCE support for extended channel layouts in the AAC encoder
 - native aptX encoder and decoder
 - Raw aptX muxer and demuxer
-- NVIDIA NVDEC-accelerated H.264, HEVC, VC1 and VP9 hwaccel decoding
+- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-2, VC1 and VP9 hwaccel decoding
 - Intel QSV-accelerated overlay filter
 - mcompand audio filter
 
diff --git a/configure b/configure
index c8e2e35192..8b7b7e164b 100755
--- a/configure
+++ b/configure
@@ -2713,6 +2713,8 @@ mpeg2_dxva2_hwaccel_deps="dxva2"
 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
 mpeg2_mediacodec_hwaccel_deps="mediacodec"
 mpeg2_mmal_hwaccel_deps="mmal"
+mpeg2_nvdec_hwaccel_deps="nvdec"
+mpeg2_nvdec_hwaccel_select="mpeg2video_decoder"
 mpeg2_qsv_hwaccel_deps="libmfx"
 mpeg2_vaapi_hwaccel_deps="vaapi"
 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6315672573..494c76da76 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -854,6 +854,7 @@ OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
 OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o
 OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL)  += dxva2_mpeg2.o
 OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL)+= dxva2_mpeg2.o
+OBJS-$(CONFIG_MPEG2_NVDEC_HWACCEL)+= nvdec_mpeg12.o
 OBJS-$(CONFIG_MPEG2_QSV_HWACCEL)  += qsvdec_other.o
 OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL)+= vaapi_mpeg2.o
 OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL)+= vdpau_mpeg12.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index e213f3757c..e0adb71951 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -96,6 +96,7 @@ static void register_all(void)
 REGISTER_HWACCEL(MPEG2_D3D11VA2,mpeg2_d3d11va2);
 REGISTER_HWACCEL(MPEG2_DXVA2,   mpeg2_dxva2);
 REGISTER_HWACCEL(MPEG2_MMAL,mpeg2_mmal);
+REGISTER_HWACCEL(MPEG2_NVDEC,   mpeg2_nvdec);
 REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);
 REGISTER_HWACCEL(MPEG2_VAAPI,   mpeg2_vaapi);
 REGISTER_HWACCEL(MPEG2_VDPAU,   mpeg2_vdpau);
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index d5bc5f21b2..2b213eebcd 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1141,6 +1141,9 @@ static const enum AVPixelFormat 
mpeg1_hwaccel_pixfmt_list_420[] = {
 };
 
 static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
+#if CONFIG_MPEG2_NVDEC_HWACCEL
+AV_PIX_FMT_CUDA,
+#endif
 #if CONFIG_MPEG2_XVMC_HWACCEL
 AV_PIX_FMT_XVMC,
 #endif
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 20d7c3db27..3d62840e9f 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -52,11 +52,12 @@ typedef struct NVDECFramePool {
 static int map_avcodec_id(enum AVCodecID id)
 {
 switch (id) {
-case AV_CODEC_ID_H264: return cudaVideoCodec_H264;
-case AV_CODEC_ID_HEVC: return cudaVideoCodec_HEVC;
-case AV_CODEC_ID_VC1:  return cudaVideoCodec_VC1;
-case AV_CODEC_ID_VP9:  return cudaVideoCodec_VP9;
-case AV_CODEC_ID_WMV3:  return cudaVideoCodec_VC1;
+case AV_CODEC_ID_H264:   return cudaVideoCodec_H264;
+case AV_CODEC_ID_HEVC:   return cudaVideoCodec_HEVC;
+case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2;
+case AV_CODEC_ID_VC1:return cudaVideoCodec_VC1;
+case AV_CODEC_ID_VP9:return cudaVideoCodec_VP9;
+case AV_CODEC_ID_WMV3:   return cudaVideoCodec_VC1;
 }
 return -1;
 }
diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c
new file mode 100644
index 00..127e843d85
--- /dev/null
+++ b/libavcodec/nvdec_mpeg12.c
@@ -0,0 +1,152 @@
+/*
+ * MPEG-2 HW decode acceleration through NVDEC
+ *
+ * Copyright (c) 2017 Philip Langdale
+ *
+ * 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-cvslog] avcodec: Fix reference data type for nvdec vc1 hwaccel

2017-11-18 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Thu Nov 16 
07:31:58 2017 -0800| [5a0f6b099f3e8fcb95a80e3ffe52b3bf369efe24] | committer: 
Philip Langdale

avcodec: Fix reference data type for nvdec vc1 hwaccel

I took the reference lookup code from the vp9 hwaccel where the
type is unsigned char, but for vc1, the type is signed int.

This is particularly important because the value used when there's
no reference is different (255 vs -1).

It didn't seem to break anything, but for mpeg1/2/4, this mistake
caused decode errors.

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

 libavcodec/nvdec_vc1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c
index cf75ba5aca..588a5b9d07 100644
--- a/libavcodec/nvdec_vc1.c
+++ b/libavcodec/nvdec_vc1.c
@@ -25,13 +25,13 @@
 #include "decode.h"
 #include "vc1.h"
 
-static unsigned char get_ref_idx(AVFrame *frame)
+static int get_ref_idx(AVFrame *frame)
 {
 FrameDecodeData *fdd;
 NVDECFrame *cf;
 
 if (!frame || !frame->private_ref)
-return 255;
+return -1;
 
 fdd = (FrameDecodeData*)frame->private_ref->data;
 cf  = (NVDECFrame*)fdd->hwaccel_priv;

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


[FFmpeg-cvslog] lavf/tcp: Fix the type of the optlen argument to getsockopt().

2017-11-18 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Sun Nov 12 
15:23:14 2017 +0100| [c3b5ea753017d1acaecdbc4dc09dae16e53a9b91] | committer: 
Carl Eugen Hoyos

lavf/tcp: Fix the type of the optlen argument to getsockopt().

Fixes a warning on aix:
libavformat/tcp.c:283:58: warning: passing argument 5 of 'getsockopt' from 
incompatible pointer type

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

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

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index f3f9d4f431..fef0729da6 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -275,7 +275,7 @@ static int tcp_get_window_size(URLContext *h)
 {
 TCPContext *s = h->priv_data;
 int avail;
-int avail_len = sizeof(avail);
+socklen_t avail_len = sizeof(avail);
 
 #if HAVE_WINSOCK2_H
 /* SO_RCVBUF with winsock only reports the actual TCP window size when

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


[FFmpeg-cvslog] avformat: remove unnecessary AVStreamParseType enum offset

2017-11-18 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Nov 18 14:55:29 
2017 -0300| [936a4c04b9fda79d824ab6c95591425b37e4086f] | committer: James Almer

avformat: remove unnecessary AVStreamParseType enum offset

Signed-off-by: James Almer 

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

 libavformat/avformat.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3c6775d0f6..322210fae0 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -785,9 +785,9 @@ enum AVStreamParseType {
 AVSTREAM_PARSE_HEADERS,/**< Only parse headers, do not repack. */
 AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of 
timestamps for frames not starting on a packet boundary */
 AVSTREAM_PARSE_FULL_ONCE,  /**< full parsing and repack of the first frame 
only, only implemented for H.264 currently */
-AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'),   /**< full parsing and 
repack with timestamp and position generation by parser for raw
- this assumes that 
each packet in the file contains no demuxer level headers and
- just codec level 
data, otherwise position generation would fail */
+AVSTREAM_PARSE_FULL_RAW,   /**< full parsing and repack with timestamp and 
position generation by parser for raw
+this assumes that each packet in the file 
contains no demuxer level headers and
+just codec level data, otherwise position 
generation would fail */
 };
 
 typedef struct AVIndexEntry {

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


[FFmpeg-cvslog] ffmpeg_filter: use nb_threads=1 on unused filtergraph

2017-11-18 Thread DHE
ffmpeg | branch: master | DHE  | Thu Nov 16 20:09:37 2017 
-0500| [ae61bcbdf83a509553445bf0cbce1dba5ac5b208] | committer: Michael 
Niedermayer

ffmpeg_filter: use nb_threads=1 on unused filtergraph

Signed-off-by: DHE 
Signed-off-by: Michael Niedermayer 

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

 fftools/ffmpeg_filter.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index aacc185059..877fd670e6 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -340,6 +340,7 @@ int init_complex_filtergraph(FilterGraph *fg)
 graph = avfilter_graph_alloc();
 if (!graph)
 return AVERROR(ENOMEM);
+graph->nb_threads = 1;
 
 ret = avfilter_graph_parse2(graph, fg->graph_desc, &inputs, &outputs);
 if (ret < 0)

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


[FFmpeg-cvslog] ffmpeg: Allow "-to" on input files in addition to "-t"

2017-11-18 Thread Vitaly _Vi Shukela
ffmpeg | branch: master | Vitaly _Vi Shukela  | Sat Nov 18 
10:36:51 2017 +0300| [80ef3c83601881ff2b6a90fa5c6e82c83aad768f] | committer: 
Michael Niedermayer

ffmpeg: Allow "-to" on input files in addition to "-t"

For some strange reason "-t" option was only implemented
for input files while both "-t" and "-to" were available
for use for output files. This made extracting a range from
input file inconvenient.

This patch enables -to option for input so one can do

ffmpeg -ss 1:23:20 -to 1:27:22.3 -i myinput.mkv ...

Signed-off-by: Vitaly _Vi Shukela 
Signed-off-by: Michael Niedermayer 

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

 doc/ffmpeg.texi  |  4 ++--
 fftools/ffmpeg_opt.c | 17 -
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 7db80ebf6a..9a90d7327a 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -289,8 +289,8 @@ see @ref{time duration syntax,,the Time duration section in 
the ffmpeg-utils(1)
 
 -to and -t are mutually exclusive and -t has priority.
 
-@item -to @var{position} (@emph{output})
-Stop writing the output at @var{position}.
+@item -to @var{position} (@emph{input/output})
+Stop writing the output or reading the input at @var{position}.
 @var{position} must be a time duration specification,
 see @ref{time duration syntax,,the Time duration section in the 
ffmpeg-utils(1) manual,ffmpeg-utils}.
 
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 47d384166c..f66f672c3c 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -976,6 +976,21 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 char *data_codec_name = NULL;
 int scan_all_pmts_set = 0;
 
+if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) {
+o->stop_time = INT64_MAX;
+av_log(NULL, AV_LOG_WARNING, "-t and -to cannot be used together; 
using -t.\n");
+}
+
+if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) {
+int64_t start_time = o->start_time == AV_NOPTS_VALUE ? 0 : 
o->start_time;
+if (o->stop_time <= start_time) {
+av_log(NULL, AV_LOG_ERROR, "-to value smaller than -ss; 
aborting.\n");
+exit_program(1);
+} else {
+o->recording_time = o->stop_time - start_time;
+}
+}
+
 if (o->format) {
 if (!(file_iformat = av_find_input_format(o->format))) {
 av_log(NULL, AV_LOG_FATAL, "Unknown input format: '%s'\n", 
o->format);
@@ -3407,7 +3422,7 @@ const OptionDef options[] = {
 OPT_INPUT | OPT_OUTPUT,  { .off = 
OFFSET(recording_time) },
 "record or transcode \"duration\" seconds of audio/video",
 "duration" },
-{ "to", HAS_ARG | OPT_TIME | OPT_OFFSET | OPT_OUTPUT,  { .off 
= OFFSET(stop_time) },
+{ "to", HAS_ARG | OPT_TIME | OPT_OFFSET | OPT_INPUT | 
OPT_OUTPUT,  { .off = OFFSET(stop_time) },
 "record or transcode stop time", "time_stop" },
 { "fs", HAS_ARG | OPT_INT64 | OPT_OFFSET | OPT_OUTPUT, { .off 
= OFFSET(limit_filesize) },
 "set the limit file size in bytes", "limit_size" },

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


[FFmpeg-cvslog] avformat/dashenc: fix min_seg_duration option size

2017-11-18 Thread James Cowgill
ffmpeg | branch: master | James Cowgill  | Sat Nov 18 
15:11:45 2017 +| [0ecb1c53c8dc385cfc7453bac26522c1da1cb6ec] | committer: 
Michael Niedermayer

avformat/dashenc: fix min_seg_duration option size

In the DASHContext structure, min_seg_duration is declared as an int,
but the AVOption list claimed it was an INT64. Change the option list
to use the correct size, which should fix some initialization errors
seen on big-endian platforms.

Signed-off-by: James Cowgill 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index d5554d1df0..ddad3351fd 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1181,7 +1181,7 @@ static const AVOption options[] = {
 { "adaptation_sets", "Adaptation sets. Syntax: id=0,streams=0,1,2 
id=1,streams=3,4 and so on", OFFSET(adaptation_sets), AV_OPT_TYPE_STRING, { 0 
}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
 { "window_size", "number of segments kept in the manifest", 
OFFSET(window_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, E },
 { "extra_window_size", "number of segments kept outside of the manifest 
before removing from disk", OFFSET(extra_window_size), AV_OPT_TYPE_INT, { .i64 
= 5 }, 0, INT_MAX, E },
-{ "min_seg_duration", "minimum segment duration (in microseconds)", 
OFFSET(min_seg_duration), AV_OPT_TYPE_INT64, { .i64 = 500 }, 0, INT_MAX, E 
},
+{ "min_seg_duration", "minimum segment duration (in microseconds)", 
OFFSET(min_seg_duration), AV_OPT_TYPE_INT, { .i64 = 500 }, 0, INT_MAX, E },
 { "remove_at_exit", "remove all segments when finished", 
OFFSET(remove_at_exit), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
 { "use_template", "Use SegmentTemplate instead of SegmentList", 
OFFSET(use_template), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },
 { "use_timeline", "Use SegmentTimeline in SegmentTemplate", 
OFFSET(use_timeline), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },

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