[FFmpeg-cvslog] avfilter: hflip, swapuv, vflip: add timeline support

2016-08-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Aug 28 11:00:06 
2016 +0200| [88bcdf109a449d302bec977997af83e1462bca6c] | committer: Paul B Mahol

avfilter: hflip,swapuv,vflip: add timeline support

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

 libavfilter/vf_hflip.c  | 11 ++-
 libavfilter/vf_swapuv.c | 14 ++
 libavfilter/vf_vflip.c  | 10 ++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index 6f92284..3e502e3 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -26,6 +26,7 @@
 
 #include 
 
+#include "libavutil/opt.h"
 #include "avfilter.h"
 #include "formats.h"
 #include "internal.h"
@@ -36,11 +37,18 @@
 #include "libavutil/imgutils.h"
 
 typedef struct FlipContext {
+const AVClass *class;
 int max_step[4];///< max pixel step for each plane, expressed as a 
number of bytes
 int planewidth[4];  ///< width of each plane
 int planeheight[4]; ///< height of each plane
 } FlipContext;
 
+static const AVOption hflip_options[] = {
+{ NULL }
+};
+
+AVFILTER_DEFINE_CLASS(hflip);
+
 static int query_formats(AVFilterContext *ctx)
 {
 AVFilterFormats *pix_fmts = NULL;
@@ -194,8 +202,9 @@ AVFilter ff_vf_hflip = {
 .name  = "hflip",
 .description   = NULL_IF_CONFIG_SMALL("Horizontally flip the input 
video."),
 .priv_size = sizeof(FlipContext),
+.priv_class= &hflip_class,
 .query_formats = query_formats,
 .inputs= avfilter_vf_hflip_inputs,
 .outputs   = avfilter_vf_hflip_outputs,
-.flags = AVFILTER_FLAG_SLICE_THREADS,
+.flags = AVFILTER_FLAG_SLICE_THREADS | 
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 };
diff --git a/libavfilter/vf_swapuv.c b/libavfilter/vf_swapuv.c
index 1a82ef3..8d62c48 100644
--- a/libavfilter/vf_swapuv.c
+++ b/libavfilter/vf_swapuv.c
@@ -23,6 +23,7 @@
  * swap UV filter
  */
 
+#include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/version.h"
 #include "avfilter.h"
@@ -30,6 +31,16 @@
 #include "internal.h"
 #include "video.h"
 
+typedef struct SwapUVContext {
+const AVClass *class;
+} SwapUVContext;
+
+static const AVOption swapuv_options[] = {
+{ NULL }
+};
+
+AVFILTER_DEFINE_CLASS(swapuv);
+
 static void do_swap(AVFrame *frame)
 {
 FFSWAP(uint8_t*, frame->data[1], frame->data[2]);
@@ -110,6 +121,9 @@ AVFilter ff_vf_swapuv = {
 .name  = "swapuv",
 .description   = NULL_IF_CONFIG_SMALL("Swap U and V components."),
 .query_formats = query_formats,
+.priv_size = sizeof(SwapUVContext),
+.priv_class= &swapuv_class,
 .inputs= swapuv_inputs,
 .outputs   = swapuv_outputs,
+.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 };
diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c
index cb085e8..c7c39d3 100644
--- a/libavfilter/vf_vflip.c
+++ b/libavfilter/vf_vflip.c
@@ -24,15 +24,23 @@
  */
 
 #include "libavutil/internal.h"
+#include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
 #include "internal.h"
 #include "video.h"
 
 typedef struct FlipContext {
+const AVClass *class;
 int vsub;   ///< vertical chroma subsampling
 } FlipContext;
 
+static const AVOption vflip_options[] = {
+{ NULL }
+};
+
+AVFILTER_DEFINE_CLASS(vflip);
+
 static int config_input(AVFilterLink *link)
 {
 FlipContext *flip = link->dst->priv;
@@ -106,6 +114,8 @@ AVFilter ff_vf_vflip = {
 .name= "vflip",
 .description = NULL_IF_CONFIG_SMALL("Flip the input video vertically."),
 .priv_size   = sizeof(FlipContext),
+.priv_class  = &vflip_class,
 .inputs  = avfilter_vf_vflip_inputs,
 .outputs = avfilter_vf_vflip_outputs,
+.flags   = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 };

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


[FFmpeg-cvslog] lavc/lpc: Add min_shift parameter in LPC

2016-08-28 Thread Jai Luthra
ffmpeg | branch: master | Jai Luthra  | Tue Aug 23 02:50:04 
2016 +0530| [0c023d181e581a0299d96a5edf7a736bdc66dc43] | committer: Michael 
Niedermayer

lavc/lpc: Add min_shift parameter in LPC

The min_shift parameter is needed by the MLP encoder

Signed-off-by: Jai Luthra 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/alacenc.c  |  4 +++-
 libavcodec/flacenc.c  |  3 ++-
 libavcodec/lpc.c  | 13 -
 libavcodec/lpc.h  |  2 +-
 libavcodec/ra144enc.c |  2 +-
 5 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c
index 9095611..804cc7b 100644
--- a/libavcodec/alacenc.c
+++ b/libavcodec/alacenc.c
@@ -38,6 +38,7 @@
 #define DEFAULT_MAX_PRED_ORDER6
 #define DEFAULT_MIN_PRED_ORDER4
 #define ALAC_MAX_LPC_PRECISION9
+#define ALAC_MIN_LPC_SHIFT0
 #define ALAC_MAX_LPC_SHIFT9
 
 #define ALAC_CHMODE_LEFT_RIGHT0
@@ -171,7 +172,8 @@ static void calc_predictor_params(AlacEncodeContext *s, int 
ch)
   s->max_prediction_order,
   ALAC_MAX_LPC_PRECISION, coefs, shift,
   FF_LPC_TYPE_LEVINSON, 0,
-  ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1);
+  ORDER_METHOD_EST, ALAC_MIN_LPC_SHIFT,
+  ALAC_MAX_LPC_SHIFT, 1);
 
 s->lpc[ch].lpc_order = opt_order;
 s->lpc[ch].lpc_quant = shift[opt_order-1];
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 9d6a742..3575f53 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -44,6 +44,7 @@
 #define MAX_PARTITION_ORDER 8
 #define MAX_PARTITIONS (1 << MAX_PARTITION_ORDER)
 #define MAX_LPC_PRECISION  15
+#define MIN_LPC_SHIFT   0
 #define MAX_LPC_SHIFT  15
 
 enum CodingMode {
@@ -884,7 +885,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
 opt_order = ff_lpc_calc_coefs(&s->lpc_ctx, smp, n, min_order, max_order,
   s->options.lpc_coeff_precision, coefs, 
shift, s->options.lpc_type,
   s->options.lpc_passes, omethod,
-  MAX_LPC_SHIFT, 0);
+  MIN_LPC_SHIFT, MAX_LPC_SHIFT, 0);
 
 if (omethod == ORDER_METHOD_2LEVEL ||
 omethod == ORDER_METHOD_4LEVEL ||
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 052aeaa..f8da1e1 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -93,7 +93,8 @@ static void lpc_compute_autocorr_c(const double *data, int 
len, int lag,
  * Quantize LPC coefficients
  */
 static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
-   int32_t *lpc_out, int *shift, int max_shift, 
int zero_shift)
+   int32_t *lpc_out, int *shift, int min_shift,
+   int max_shift, int zero_shift)
 {
 int i;
 double cmax, error;
@@ -118,7 +119,7 @@ static void quantize_lpc_coefs(double *lpc_in, int order, 
int precision,
 
 /* calculate level shift which scales max coeff to available bits */
 sh = max_shift;
-while((cmax * (1 << sh) > qmax) && (sh > 0)) {
+while((cmax * (1 << sh) > qmax) && (sh > min_shift)) {
 sh--;
 }
 
@@ -201,7 +202,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
   int max_order, int precision,
   int32_t coefs[][MAX_LPC_ORDER], int *shift,
   enum FFLPCType lpc_type, int lpc_passes,
-  int omethod, int max_shift, int zero_shift)
+  int omethod, int min_shift, int max_shift, int 
zero_shift)
 {
 double autoc[MAX_LPC_ORDER+1];
 double ref[MAX_LPC_ORDER] = { 0 };
@@ -284,10 +285,12 @@ int ff_lpc_calc_coefs(LPCContext *s,
 if(omethod == ORDER_METHOD_EST) {
 opt_order = estimate_best_order(ref, min_order, max_order);
 i = opt_order-1;
-quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], 
max_shift, zero_shift);
+quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i],
+   min_shift, max_shift, zero_shift);
 } else {
 for(i=min_order-1; ilpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, 
LPC_ORDER,
   LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON,
-  0, ORDER_METHOD_EST, 12, 0);
+  0, ORDER_METHOD_EST, 0, 12, 0);
 for (i = 0; i < LPC_ORDER; i++)
 block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] <<
 (12 - shift[LPC_ORDER - 1]));

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


[FFmpeg-cvslog] MAINTAINER: add myself for Motion Estimation and Interpolation filters

2016-08-28 Thread Davinder Singh
ffmpeg | branch: master | Davinder Singh  | Sat Aug 27 
03:18:32 2016 +0530| [fecf5ae9aa7499280e62f5244dfd2b65c92f532a] | committer: 
Michael Niedermayer

MAINTAINER: add myself for Motion Estimation and Interpolation filters

Signed-off-by: Michael Niedermayer 

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

 MAINTAINERS | 4 
 1 file changed, 4 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9fab34d..7f3ca36 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -295,6 +295,8 @@ libavfilter
 Generic parts:
   graphdump.c   Nicolas George
 
+  motion_estimation.c   Davinder Singh
+
 Filters:
   f_drawgraph.c Paul B Mahol
   af_adelay.c   Paul B Mahol
@@ -336,6 +338,8 @@ Filters:
   vf_il.c   Paul B Mahol
   vf_lenscorrection.c   Daniel Oberhoff
   vf_mergeplanes.c  Paul B Mahol
+  vf_mestimate.cDavinder Singh
+  vf_minterpolate.c Davinder Singh
   vf_neighbor.c Paul B Mahol
   vf_psnr.c Paul B Mahol
   vf_random.c   Paul B Mahol

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


[FFmpeg-cvslog] avformat: fix decoded creation_time timestamps

2016-08-28 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Thu Jun 30 00:55:48 
2016 +0200| [13b90ff2c12749aac58d22da4cb47c24b7a37b04] | committer: Marton 
Balint

avformat: fix decoded creation_time timestamps

Use proper ISO 8601 timestamps which also signal that they are in UTC.

This changes the format of creation_time and modification_date metadata values
from 2016-06-01 22:30:00 to 2016-01-01T22:30:00.00Z

Fixes ticket #5673.

Signed-off-by: Marton Balint 

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

 libavformat/matroskadec.c |  7 +--
 libavformat/mov.c |  9 +
 libavformat/mxfdec.c  | 14 --
 libavformat/version.h |  2 +-
 4 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d07a092..77b8a5d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1691,13 +1691,8 @@ static int matroska_aac_sri(int samplerate)
 
 static void matroska_metadata_creation_time(AVDictionary **metadata, int64_t 
date_utc)
 {
-char buffer[32];
 /* Convert to seconds and adjust by number of seconds between 2001-01-01 
and Epoch */
-time_t creation_time = date_utc / 10 + 978307200;
-struct tm tmpbuf, *ptm = gmtime_r(&creation_time, &tmpbuf);
-if (!ptm) return;
-if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm))
-av_dict_set(metadata, "creation_time", buffer, 0);
+avpriv_dict_set_timestamp(metadata, "creation_time", date_utc / 1000 + 
9783072LL);
 }
 
 static int matroska_parse_flac(AVFormatContext *s,
diff --git a/libavformat/mov.c b/libavformat/mov.c
index bc11fb8..6282d8f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1156,17 +1156,10 @@ static int mov_read_moof(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 
 static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time)
 {
-char buffer[32];
 if (time) {
-struct tm *ptm, tmbuf;
-time_t timet;
 if(time >= 2082844800)
 time -= 2082844800;  /* seconds between 1904-01-01 and Epoch */
-timet = time;
-ptm = gmtime_r(&timet, &tmbuf);
-if (!ptm) return;
-if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm))
-av_dict_set(metadata, "creation_time", buffer, 0);
+avpriv_dict_set_timestamp(metadata, "creation_time", time * 100);
 }
 }
 
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 0affca9..0b16463 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -50,6 +50,7 @@
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "avformat.h"
 #include "internal.h"
@@ -2159,7 +2160,7 @@ fail_and_free:
 return ret;
 }
 
-static int mxf_timestamp_to_str(uint64_t timestamp, char **str)
+static int64_t mxf_timestamp_to_int64(uint64_t timestamp)
 {
 struct tm time = { 0 };
 time.tm_year = (timestamp >> 48) - 1900;
@@ -2178,13 +2179,7 @@ static int mxf_timestamp_to_str(uint64_t timestamp, char 
**str)
 time.tm_min  = av_clip(time.tm_min,  0, 59);
 time.tm_sec  = av_clip(time.tm_sec,  0, 59);
 
-*str = av_mallocz(32);
-if (!*str)
-return AVERROR(ENOMEM);
-if (!strftime(*str, 32, "%Y-%m-%d %H:%M:%S", &time))
-(*str)[0] = '\0';
-
-return 0;
+return (int64_t)av_timegm(&time) * 100;
 }
 
 #define SET_STR_METADATA(pb, name, str) do { \
@@ -2202,9 +2197,8 @@ static int mxf_timestamp_to_str(uint64_t timestamp, char 
**str)
 
 #define SET_TS_METADATA(pb, name, var, str) do { \
 var = avio_rb64(pb); \
-if ((ret = mxf_timestamp_to_str(var, &str)) < 0) \
+if ((ret = avpriv_dict_set_timestamp(&s->metadata, name, 
mxf_timestamp_to_int64(var)) < 0)) \
 return ret; \
-av_dict_set(&s->metadata, name, str, AV_DICT_DONT_STRDUP_VAL); \
 } while (0)
 
 static int mxf_read_identification_metadata(void *arg, AVIOContext *pb, int 
tag, int size, UID _uid, int64_t klv_offset)
diff --git a/libavformat/version.h b/libavformat/version.h
index 88fd4cc..f3da968 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  57
 #define LIBAVFORMAT_VERSION_MINOR  48
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \

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


[FFmpeg-cvslog] avcodec/nvenc: added support for 10 bit HEVC encoding

2016-08-28 Thread Oliver Collyer
ffmpeg | branch: master | Oliver Collyer  | Thu Aug 25 
16:18:03 2016 +0100| [d1bf8a3aa878003f5019bb97c3228f8027e5d116] | committer: 
Timo Rothenpieler

avcodec/nvenc: added support for 10 bit HEVC encoding

Signed-off-by: Timo Rothenpieler 

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

 libavcodec/nvenc.c  | 73 ++---
 libavcodec/nvenc.h  |  5 
 libavcodec/nvenc_hevc.c |  5 ++--
 libavcodec/version.h|  2 +-
 4 files changed, 78 insertions(+), 7 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 984dd3b..5706590 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -76,13 +76,21 @@
 const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
 AV_PIX_FMT_YUV420P,
 AV_PIX_FMT_NV12,
+AV_PIX_FMT_P010,
 AV_PIX_FMT_YUV444P,
+AV_PIX_FMT_YUV444P16,
 #if CONFIG_CUDA
 AV_PIX_FMT_CUDA,
 #endif
 AV_PIX_FMT_NONE
 };
 
+#define IS_10BIT(pix_fmt) (pix_fmt == AV_PIX_FMT_P010 ||\
+   pix_fmt == AV_PIX_FMT_YUV444P16)
+
+#define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P || \
+pix_fmt == AV_PIX_FMT_YUV444P16)
+
 static const struct {
 NVENCSTATUS nverr;
 int averr;
@@ -273,7 +281,7 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 }
 
 ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_YUV444_ENCODE);
-if (ctx->data_pix_fmt == AV_PIX_FMT_YUV444P && ret <= 0) {
+if (IS_YUV444(ctx->data_pix_fmt) && ret <= 0) {
 av_log(avctx, AV_LOG_VERBOSE, "YUV444P not supported\n");
 return AVERROR(ENOSYS);
 }
@@ -314,6 +322,12 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 return AVERROR(ENOSYS);
 }
 
+ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_10BIT_ENCODE);
+if (IS_10BIT(ctx->data_pix_fmt) && ret <= 0) {
+av_log(avctx, AV_LOG_VERBOSE, "10 bit encode not supported\n");
+return AVERROR(ENOSYS);
+}
+
 return 0;
 }
 
@@ -800,9 +814,26 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext 
*avctx)
 hevc->outputPictureTimingSEI   = 1;
 }
 
-/* No other profile is supported in the current SDK version 5 */
-cc->profileGUID = NV_ENC_HEVC_PROFILE_MAIN_GUID;
-avctx->profile = FF_PROFILE_HEVC_MAIN;
+switch(ctx->profile) {
+case NV_ENC_HEVC_PROFILE_MAIN:
+cc->profileGUID = NV_ENC_HEVC_PROFILE_MAIN_GUID;
+avctx->profile = FF_PROFILE_HEVC_MAIN;
+break;
+case NV_ENC_HEVC_PROFILE_MAIN_10:
+cc->profileGUID = NV_ENC_HEVC_PROFILE_MAIN10_GUID;
+avctx->profile = FF_PROFILE_HEVC_MAIN_10;
+break;
+}
+
+// force setting profile as main10 if input is 10 bit
+if (IS_10BIT(ctx->data_pix_fmt)) {
+cc->profileGUID = NV_ENC_HEVC_PROFILE_MAIN10_GUID;
+avctx->profile = FF_PROFILE_HEVC_MAIN_10;
+}
+
+hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1;
+
+hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
 
 hevc->level = ctx->level;
 
@@ -958,10 +989,18 @@ static av_cold int nvenc_alloc_surface(AVCodecContext 
*avctx, int idx)
 ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_NV12_PL;
 break;
 
+case AV_PIX_FMT_P010:
+ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_YUV420_10BIT;
+break;
+
 case AV_PIX_FMT_YUV444P:
 ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_YUV444_PL;
 break;
 
+case AV_PIX_FMT_YUV444P16:
+ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
+break;
+
 default:
 av_log(avctx, AV_LOG_FATAL, "Invalid input pixel format\n");
 return AVERROR(EINVAL);
@@ -1238,6 +1277,16 @@ static int nvenc_copy_frame(AVCodecContext *avctx, 
NvencSurface *inSurf,
 av_image_copy_plane(buf, lockBufferParams->pitch,
 frame->data[1], frame->linesize[1],
 avctx->width, avctx->height >> 1);
+} else if (frame->format == AV_PIX_FMT_P010) {
+av_image_copy_plane(buf, lockBufferParams->pitch,
+frame->data[0], frame->linesize[0],
+avctx->width << 1, avctx->height);
+
+buf += off;
+
+av_image_copy_plane(buf, lockBufferParams->pitch,
+frame->data[1], frame->linesize[1],
+avctx->width << 1, avctx->height >> 1);
 } else if (frame->format == AV_PIX_FMT_YUV444P) {
 av_image_copy_plane(buf, lockBufferParams->pitch,
 frame->data[0], frame->linesize[0],
@@ -1254,6 +1303,22 @@ static int nvenc_copy_frame(AVCodecContext *avctx, 
NvencSurface *inSurf,
 av_image_copy_plane(buf, lockBufferParams->pitch,
 frame->data[2], frame->linesize[2],
 avctx->width, avctx->height);
+} else if (frame->format == AV_PIX_FMT_YUV444P16) {
+av_image_copy_plane(buf, lockBufferParams->pitch,
+frame->data[0], frame->linesi

[FFmpeg-cvslog] avcodec/nvenc: added support for rate control lookahead

2016-08-28 Thread Oliver Collyer
ffmpeg | branch: master | Oliver Collyer  | Thu Aug 25 
16:20:03 2016 +0100| [a81b398e869ed2f7f972f797f8992ad32bfb8ba1] | committer: 
Timo Rothenpieler

avcodec/nvenc: added support for rate control lookahead

Signed-off-by: Timo Rothenpieler 

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

 libavcodec/nvenc.c  | 11 +++
 libavcodec/nvenc.h  |  1 +
 libavcodec/nvenc_h264.c |  1 +
 libavcodec/nvenc_hevc.c |  1 +
 4 files changed, 14 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 5706590..d1c7d93 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -328,6 +328,12 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 return AVERROR(ENOSYS);
 }
 
+ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOOKAHEAD);
+if (ctx->rc_lookahead > 0 && ret <= 0) {
+av_log(avctx, AV_LOG_VERBOSE, "RC lookahead not supported\n");
+return AVERROR(ENOSYS);
+}
+
 return 0;
 }
 
@@ -687,6 +693,11 @@ static av_cold void 
nvenc_setup_rate_control(AVCodecContext *avctx)
 } else if (ctx->encode_config.rcParams.averageBitRate > 0) {
 ctx->encode_config.rcParams.vbvBufferSize = 2 * 
ctx->encode_config.rcParams.averageBitRate;
 }
+
+if (ctx->rc_lookahead > 0) {
+ctx->encode_config.rcParams.enableLookahead = 1;
+ctx->encode_config.rcParams.lookaheadDepth = FFMIN(ctx->rc_lookahead, 
32);
+}
 }
 
 static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 37d41ea..cd86c47 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -179,6 +179,7 @@ typedef struct NvencContext
 int device;
 int flags;
 int async_depth;
+int rc_lookahead;
 } NvencContext;
 
 int ff_nvenc_encode_init(AVCodecContext *avctx);
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index b576f15..4ef9836 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -76,6 +76,7 @@ static const AVOption options[] = {
 { "ll_2pass_quality", "Multi-pass optimized for image quality (only for 
low-latency presets)",   0, AV_OPT_TYPE_CONST,  { .i64 = 
NV_ENC_PARAMS_RC_2_PASS_QUALITY },   0, 0, VE, "rc" },
 { "ll_2pass_size","Multi-pass optimized for constant frame size (only 
for low-latency presets)", 0, AV_OPT_TYPE_CONST,  { .i64 = 
NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP }, 0, 0, VE, "rc" },
 { "vbr_2pass","Multi-pass variable bitrate mode",  
  0, AV_OPT_TYPE_CONST,  { .i64 = 
NV_ENC_PARAMS_RC_2_PASS_VBR },   0, 0, VE, "rc" },
+{ "rc-lookahead", "Number of frames to look ahead for rate-control", 
OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE },
 { "surfaces", "Number of concurrent surfaces",OFFSET(nb_surfaces), 
AV_OPT_TYPE_INT,{ .i64 = 32 },   0, INT_MAX, VE },
 { "cbr", "Use cbr encoding mode", OFFSET(cbr), AV_OPT_TYPE_BOOL, { .i64 = 
0 }, 0, 1, VE },
 { "2pass", "Use 2pass encoding mode", OFFSET(twopass), AV_OPT_TYPE_BOOL, { 
.i64 = -1 }, -1, 1, VE },
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index d9a4bf6..e875772 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -74,6 +74,7 @@ static const AVOption options[] = {
 { "ll_2pass_quality", "Multi-pass optimized for image quality (only for 
low-latency presets)",   0, AV_OPT_TYPE_CONST,  { .i64 = 
NV_ENC_PARAMS_RC_2_PASS_QUALITY },   0, 0, VE, "rc" },
 { "ll_2pass_size","Multi-pass optimized for constant frame size (only 
for low-latency presets)", 0, AV_OPT_TYPE_CONST,  { .i64 = 
NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP }, 0, 0, VE, "rc" },
 { "vbr_2pass","Multi-pass variable bitrate mode",  
  0, AV_OPT_TYPE_CONST,  { .i64 = 
NV_ENC_PARAMS_RC_2_PASS_VBR },   0, 0, VE, "rc" },
+{ "rc-lookahead", "Number of frames to look ahead for rate-control", 
OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE },
 { "surfaces", "Number of concurrent surfaces",OFFSET(nb_surfaces), 
AV_OPT_TYPE_INT,{ .i64 = 32 },   0, INT_MAX, VE },
 { "cbr", "Use cbr encoding mode", OFFSET(cbr), AV_OPT_TYPE_BOOL, { .i64 = 
0 }, 0, 1, VE },
 { "2pass", "Use 2pass encoding mode", OFFSET(twopass), AV_OPT_TYPE_BOOL, { 
.i64 = -1 }, -1, 1, VE },

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


[FFmpeg-cvslog] ffmpeg: fix -stream_loop with -re

2016-08-28 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Fri Jul  1 01:12:25 
2016 +0200| [2ee8a4f8873b9f7bb8ae7ed0ba40b45f27f634d4] | committer: Marton 
Balint

ffmpeg: fix -stream_loop with -re

Otherwise the stream failed with EAGAIN.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Marton Balint 

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

 ffmpeg.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index bad311d..3229823 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3801,6 +3801,10 @@ static int process_input(int file_index)
 if ((ret = seek_to_start(ifile, is)) < 0)
 return ret;
 ret = get_input_packet(ifile, &pkt);
+if (ret == AVERROR(EAGAIN)) {
+ifile->eagain = 1;
+return ret;
+}
 }
 if (ret < 0) {
 if (ret != AVERROR_EOF) {

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


[FFmpeg-cvslog] avcodec/nvenc: fix potantially uninitialized free

2016-08-28 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Sun Aug 
28 18:19:21 2016 +0200| [a19989cae581817e8857623d3afc447372b1c0e3] | committer: 
Timo Rothenpieler

avcodec/nvenc: fix potantially uninitialized free

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

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

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index c92df53..8994af1 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1536,7 +1536,7 @@ static int process_output_surface(AVCodecContext *avctx, 
AVPacket *pkt, NvencSur
 NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
 
 uint32_t slice_mode_data;
-uint32_t *slice_offsets;
+uint32_t *slice_offsets = NULL;
 NV_ENC_LOCK_BITSTREAM lock_params = { 0 };
 NVENCSTATUS nv_status;
 int res = 0;

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


[FFmpeg-cvslog] avcodec/nvenc: fix library names on cygwin

2016-08-28 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Sun Aug 
28 17:54:29 2016 +0200| [19e75fd8838df668fb4b9af95b3a57874b1af32a] | committer: 
Timo Rothenpieler

avcodec/nvenc: fix library names on cygwin

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

 libavcodec/nvenc.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index d1c7d93..c92df53 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -21,24 +21,26 @@
 
 #include "config.h"
 
-#if defined(_WIN32)
-#include 
-
-#define CUDA_LIBNAME TEXT("nvcuda.dll")
-#if ARCH_X86_64
-#define NVENC_LIBNAME TEXT("nvEncodeAPI64.dll")
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define CUDA_LIBNAME "nvcuda.dll"
+# if ARCH_X86_64
+#  define NVENC_LIBNAME "nvEncodeAPI64.dll"
+# else
+#  define NVENC_LIBNAME "nvEncodeAPI.dll"
+# endif
 #else
-#define NVENC_LIBNAME TEXT("nvEncodeAPI.dll")
+# define CUDA_LIBNAME "libcuda.so"
+# define NVENC_LIBNAME "libnvidia-encode.so"
 #endif
 
-#define dlopen(filename, flags) LoadLibrary((filename))
+#if defined(_WIN32)
+#include 
+
+#define dlopen(filename, flags) LoadLibrary(TEXT(filename))
 #define dlsym(handle, symbol)   GetProcAddress(handle, symbol)
 #define dlclose(handle) FreeLibrary(handle)
 #else
 #include 
-
-#define CUDA_LIBNAME "libcuda.so"
-#define NVENC_LIBNAME "libnvidia-encode.so"
 #endif
 
 #include "libavutil/hwcontext.h"

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


[FFmpeg-cvslog] avcodec/nvenc: update license header

2016-08-28 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Sun Aug 
28 19:51:22 2016 +0200| [cac2df230e730906bd1ec6cbd18670214fbf92bb] | committer: 
Timo Rothenpieler

avcodec/nvenc: update license header

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

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

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index e22df52..283f29f 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1,6 +1,6 @@
 /*
- * H.264 hardware encoding using nvidia nvenc
- * Copyright (c) 2014 Timo Rothenpieler 
+ * H.264/HEVC hardware encoding using nvidia nvenc
+ * Copyright (c) 2016 Timo Rothenpieler 
  *
  * This file is part of FFmpeg.
  *

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


[FFmpeg-cvslog] avcodec/nvenc: use proper soname for cuda/nvenc libraries

2016-08-28 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Sun Aug 
28 19:49:56 2016 +0200| [26a5cbd7811e2b8b497a9577a69588024070c093] | committer: 
Timo Rothenpieler

avcodec/nvenc: use proper soname for cuda/nvenc libraries

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

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

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 553f223..e22df52 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -29,8 +29,8 @@
 #  define NVENC_LIBNAME "nvEncodeAPI.dll"
 # endif
 #else
-# define CUDA_LIBNAME "libcuda.so"
-# define NVENC_LIBNAME "libnvidia-encode.so"
+# define CUDA_LIBNAME "libcuda.so.1"
+# define NVENC_LIBNAME "libnvidia-encode.so.1"
 #endif
 
 #if defined(_WIN32)

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


[FFmpeg-cvslog] avcodec/nvenc: check maximum driver API version

2016-08-28 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Sun Aug 
28 19:46:44 2016 +0200| [df615efcf275d87ec6e19be1c1b2f16e9b5d4e72] | committer: 
Timo Rothenpieler

avcodec/nvenc: check maximum driver API version

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

 libavcodec/nvenc.c | 18 ++
 libavcodec/nvenc.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 8994af1..553f223 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -155,8 +155,10 @@ static av_cold int nvenc_load_libraries(AVCodecContext 
*avctx)
 {
 NvencContext *ctx = avctx->priv_data;
 NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
+PNVENCODEAPIGETMAXSUPPORTEDVERSION nvenc_get_max_ver;
 PNVENCODEAPICREATEINSTANCE nvenc_create_instance;
 NVENCSTATUS err;
+uint32_t nvenc_max_ver;
 
 #if CONFIG_CUDA
 dl_fn->cu_init  = cuInit;
@@ -183,9 +185,25 @@ static av_cold int nvenc_load_libraries(AVCodecContext 
*avctx)
 
 LOAD_LIBRARY(dl_fn->nvenc, NVENC_LIBNAME);
 
+LOAD_SYMBOL(nvenc_get_max_ver, dl_fn->nvenc,
+"NvEncodeAPIGetMaxSupportedVersion");
 LOAD_SYMBOL(nvenc_create_instance, dl_fn->nvenc,
 "NvEncodeAPICreateInstance");
 
+err = nvenc_get_max_ver(&nvenc_max_ver);
+if (err != NV_ENC_SUCCESS)
+return nvenc_print_error(avctx, err, "Failed to query nvenc max 
version");
+
+av_log(avctx, AV_LOG_VERBOSE, "Loaded Nvenc version %d.%d\n", 
nvenc_max_ver >> 4, nvenc_max_ver & 0xf);
+
+if ((NVENCAPI_MAJOR_VERSION << 4 | NVENCAPI_MINOR_VERSION) > 
nvenc_max_ver) {
+av_log(avctx, AV_LOG_ERROR, "Driver does not support the required 
nvenc API version. "
+   "Required: %d.%d Found: %d.%d\n",
+   NVENCAPI_MAJOR_VERSION, NVENCAPI_MINOR_VERSION,
+   nvenc_max_ver >> 4, nvenc_max_ver & 0xf);
+return AVERROR(ENOSYS);
+}
+
 dl_fn->nvenc_funcs.version = NV_ENCODE_API_FUNCTION_LIST_VER;
 
 err = nvenc_create_instance(&dl_fn->nvenc_funcs);
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index cd86c47..c57f1ae 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -72,6 +72,7 @@ typedef CUresult(CUDAAPI *PCUCTXCREATE)(CUcontext *pctx, 
unsigned int flags, CUd
 typedef CUresult(CUDAAPI *PCUCTXPOPCURRENT)(CUcontext *pctx);
 typedef CUresult(CUDAAPI *PCUCTXDESTROY)(CUcontext ctx);
 
+typedef NVENCSTATUS (NVENCAPI *PNVENCODEAPIGETMAXSUPPORTEDVERSION)(uint32_t* 
version);
 typedef NVENCSTATUS (NVENCAPI 
*PNVENCODEAPICREATEINSTANCE)(NV_ENCODE_API_FUNCTION_LIST *functionList);
 
 typedef struct NvencDynLoadFunctions

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


[FFmpeg-cvslog] avformat/mov: aax: pass proper AVClass to av_log()

2016-08-28 Thread Thomas Hebb
ffmpeg | branch: master | Thomas Hebb  | Sun Aug 28 
12:24:55 2016 -0400| [a37e6dd2ba85a44fc283d24f3ee3bdd8abad5b9b] | committer: 
Michael Niedermayer

avformat/mov: aax: pass proper AVClass to av_log()

av_log() expects its first parameter to be a pointer to a struct whose
first element is a pointer to an AVClass. In what I can only imagine is
a typo, one call to av_log() in the AAX decryption code instead passes
a pointer to an AVSHA struct, which doesn't even contain a pointer as
its first element, much less a pointer to an AVClass. Change the call to
pass the current MOVContext, as surrounding calls do.

The incorrect AVClass was causing mpv to emit the warning "av_log
callback called with bad parameters" when playing an .aax file.

Signed-off-by: Thomas Hebb 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6282d8f..f499906 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -997,7 +997,7 @@ static int mov_read_adrm(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 av_log(c->fc, AV_LOG_INFO, "[aax] file checksum == "); // required by 
external tools
 for (i = 0; i < 20; i++)
-av_log(sha, AV_LOG_INFO, "%02x", file_checksum[i]);
+av_log(c->fc, AV_LOG_INFO, "%02x", file_checksum[i]);
 av_log(c->fc, AV_LOG_INFO, "\n");
 
 /* verify activation data */

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