[FFmpeg-cvslog] avcodec/nvdec: Explicitly mark codecs that support 444 output formats

2019-02-16 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Sat Oct  6 
20:20:58 2018 -0700| [83c7ac2e47efd96927127c1c385cdbb5fb53cb02] | committer: 
Philip Langdale

avcodec/nvdec: Explicitly mark codecs that support 444 output formats

With the introduction of HEVC 444 support, we technically have two
codecs that can handle 444 - HEVC and MJPEG. In the case of MJPEG,
it can decode, but can only output one of the semi-planar formats.

That means we need additional logic to decide whether to use a
444 output format or not.

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

 libavcodec/nvdec.c|  7 ---
 libavcodec/nvdec.h|  5 -
 libavcodec/nvdec_h264.c   |  2 +-
 libavcodec/nvdec_hevc.c   | 10 --
 libavcodec/nvdec_mjpeg.c  |  2 +-
 libavcodec/nvdec_mpeg12.c |  2 +-
 libavcodec/nvdec_mpeg4.c  |  2 +-
 libavcodec/nvdec_vc1.c|  2 +-
 libavcodec/nvdec_vp8.c|  2 +-
 libavcodec/nvdec_vp9.c|  2 +-
 10 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 72201a1123..b60da24301 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -298,7 +298,7 @@ int ff_nvdec_decode_init(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_ERROR, "Unsupported chroma format\n");
 return AVERROR(ENOSYS);
 }
-chroma_444 = cuvid_chroma_format == cudaVideoChromaFormat_444;
+chroma_444 = ctx->supports_444 && cuvid_chroma_format == 
cudaVideoChromaFormat_444;
 
 if (!avctx->hw_frames_ctx) {
 ret = ff_decode_get_hw_frames_ctx(avctx, AV_HWDEVICE_TYPE_CUDA);
@@ -587,7 +587,8 @@ static AVBufferRef *nvdec_alloc_dummy(int size)
 
 int ff_nvdec_frame_params(AVCodecContext *avctx,
   AVBufferRef *hw_frames_ctx,
-  int dpb_size)
+  int dpb_size,
+  int supports_444)
 {
 AVHWFramesContext *frames_ctx = (AVHWFramesContext*)hw_frames_ctx->data;
 const AVPixFmtDescriptor *sw_desc;
@@ -608,7 +609,7 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_VERBOSE, "Unsupported chroma format\n");
 return AVERROR(EINVAL);
 }
-chroma_444 = cuvid_chroma_format == cudaVideoChromaFormat_444;
+chroma_444 = supports_444 && cuvid_chroma_format == 
cudaVideoChromaFormat_444;
 
 frames_ctx->format= AV_PIX_FMT_CUDA;
 frames_ctx->width = (avctx->coded_width + 1) & ~1;
diff --git a/libavcodec/nvdec.h b/libavcodec/nvdec.h
index 85a0fcf725..09ae8c37e6 100644
--- a/libavcodec/nvdec.h
+++ b/libavcodec/nvdec.h
@@ -61,6 +61,8 @@ typedef struct NVDECContext {
 unsigned *slice_offsets;
 int   nb_slices;
 unsigned int  slice_offsets_allocated;
+
+int   supports_444;
 } NVDECContext;
 
 int ff_nvdec_decode_init(AVCodecContext *avctx);
@@ -72,7 +74,8 @@ int ff_nvdec_simple_decode_slice(AVCodecContext *avctx, const 
uint8_t *buffer,
  uint32_t size);
 int ff_nvdec_frame_params(AVCodecContext *avctx,
   AVBufferRef *hw_frames_ctx,
-  int dpb_size);
+  int dpb_size,
+  int supports_444);
 int ff_nvdec_get_ref_idx(AVFrame *frame);
 
 #endif /* AVCODEC_NVDEC_H */
diff --git a/libavcodec/nvdec_h264.c b/libavcodec/nvdec_h264.c
index 25b30329d0..116bd4fb5d 100644
--- a/libavcodec/nvdec_h264.c
+++ b/libavcodec/nvdec_h264.c
@@ -166,7 +166,7 @@ static int nvdec_h264_frame_params(AVCodecContext *avctx,
 {
 const H264Context *h = avctx->priv_data;
 const SPS   *sps = h->ps.sps;
-return ff_nvdec_frame_params(avctx, hw_frames_ctx, sps->ref_frame_count + 
sps->num_reorder_frames);
+return ff_nvdec_frame_params(avctx, hw_frames_ctx, sps->ref_frame_count + 
sps->num_reorder_frames, 0);
 }
 
 const AVHWAccel ff_h264_nvdec_hwaccel = {
diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c
index d11b5e8a38..590278ba04 100644
--- a/libavcodec/nvdec_hevc.c
+++ b/libavcodec/nvdec_hevc.c
@@ -299,7 +299,13 @@ static int nvdec_hevc_frame_params(AVCodecContext *avctx,
 {
 const HEVCContext *s = avctx->priv_data;
 const HEVCSPS *sps = s->ps.sps;
-return ff_nvdec_frame_params(avctx, hw_frames_ctx, 
sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering + 1);
+return ff_nvdec_frame_params(avctx, hw_frames_ctx, 
sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering + 1, 1);
+}
+
+static int nvdec_hevc_decode_init(AVCodecContext *avctx) {
+NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
+ctx->supports_444 = 1;
+return ff_nvdec_decode_init(avctx);
 }
 
 const AVHWAccel ff_hevc_nvdec_hwaccel = {
@@ -311,7 +317,7 @@ const AVHWAccel ff_hevc_nvdec_hwaccel = {
 .end_frame= ff_nvdec_end_frame,
 .decode_slice = nvdec_hevc_decode_slice,
 .frame_params = nvdec_hevc_frame_params,
-

[FFmpeg-cvslog] avcodec/hevc_ps: Expose all SPS and PPS range extension flags

2019-02-16 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Wed Feb 13 
12:40:52 2019 -0800| [f4ea930a119298c6110ee4e3d24219a66e27e230] | committer: 
Philip Langdale

avcodec/hevc_ps: Expose all SPS and PPS range extension flags

We need all the flags to be exposed to be able to pass them on to
HW decoders. I did not attempt to nuance any of the warnings about
flags being unsupported as there's no way, at the point we extract
flags, to say whether an HW decoder is being used.

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

 libavcodec/hevc_ps.c | 19 ---
 libavcodec/hevc_ps.h |  4 
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index ea984af0a1..80df417e4f 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1102,20 +1102,17 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
unsigned int *sps_id,
 decode_vui(gb, avctx, apply_defdispwin, sps);
 
 if (get_bits1(gb)) { // sps_extension_flag
-int sps_range_extension_flag = get_bits1(gb);
+sps->sps_range_extension_flag = get_bits1(gb);
 skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7);
-if (sps_range_extension_flag) {
-int extended_precision_processing_flag;
-int cabac_bypass_alignment_enabled_flag;
-
+if (sps->sps_range_extension_flag) {
 sps->transform_skip_rotation_enabled_flag = get_bits1(gb);
 sps->transform_skip_context_enabled_flag  = get_bits1(gb);
 sps->implicit_rdpcm_enabled_flag = get_bits1(gb);
 
 sps->explicit_rdpcm_enabled_flag = get_bits1(gb);
 
-extended_precision_processing_flag = get_bits1(gb);
-if (extended_precision_processing_flag)
+sps->extended_precision_processing_flag = get_bits1(gb);
+if (sps->extended_precision_processing_flag)
 av_log(avctx, AV_LOG_WARNING,
"extended_precision_processing_flag not yet implemented\n");
 
@@ -1127,8 +1124,8 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
unsigned int *sps_id,
 
 sps->persistent_rice_adaptation_enabled_flag = get_bits1(gb);
 
-cabac_bypass_alignment_enabled_flag  = get_bits1(gb);
-if (cabac_bypass_alignment_enabled_flag)
+sps->cabac_bypass_alignment_enabled_flag  = get_bits1(gb);
+if (sps->cabac_bypass_alignment_enabled_flag)
 av_log(avctx, AV_LOG_WARNING,
"cabac_bypass_alignment_enabled_flag not yet 
implemented\n");
 }
@@ -1686,9 +1683,9 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, 
AVCodecContext *avctx,
 pps->slice_header_extension_present_flag = get_bits1(gb);
 
 if (get_bits1(gb)) { // pps_extension_present_flag
-int pps_range_extensions_flag = get_bits1(gb);
+pps->pps_range_extensions_flag = get_bits1(gb);
 skip_bits(gb, 7); // pps_extension_7bits
-if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && 
pps_range_extensions_flag) {
+if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && 
pps->pps_range_extensions_flag) {
 if ((ret = pps_range_extensions(gb, avctx, pps, sps)) < 0)
 goto err;
 }
diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
index 1fbda199e3..bbaa9205ef 100644
--- a/libavcodec/hevc_ps.h
+++ b/libavcodec/hevc_ps.h
@@ -284,13 +284,16 @@ typedef struct HEVCSPS {
 int max_transform_hierarchy_depth_inter;
 int max_transform_hierarchy_depth_intra;
 
+int sps_range_extension_flag;
 int transform_skip_rotation_enabled_flag;
 int transform_skip_context_enabled_flag;
 int implicit_rdpcm_enabled_flag;
 int explicit_rdpcm_enabled_flag;
+int extended_precision_processing_flag;
 int intra_smoothing_disabled_flag;
 int high_precision_offsets_enabled_flag;
 int persistent_rice_adaptation_enabled_flag;
+int cabac_bypass_alignment_enabled_flag;
 
 ///< coded frame dimension in various units
 int width;
@@ -365,6 +368,7 @@ typedef struct HEVCPPS {
 int num_extra_slice_header_bits;
 uint8_t slice_header_extension_present_flag;
 uint8_t log2_max_transform_skip_block_size;
+uint8_t pps_range_extensions_flag;
 uint8_t cross_component_prediction_enabled_flag;
 uint8_t chroma_qp_offset_list_enabled_flag;
 uint8_t diff_cu_chroma_qp_offset_depth;

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


[FFmpeg-cvslog] avcodec/nvdec: Add support for decoding HEVC 4:4:4 content

2019-02-16 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Sat Oct  6 
18:11:52 2018 -0700| [e06ccfbe1d33c00d6f1df202a514219c7fdb7c03] | committer: 
Philip Langdale

avcodec/nvdec: Add support for decoding HEVC 4:4:4 content

The latest generation video decoder on the Turing chips supports
decoding HEVC 4:4:4. Supporting this is relatively straight-forward;
we need to account for the different chroma format and pick the
right output and sw formats at the right times.

There was one bug which was the hard-coded assumption that the
first chroma plane would be half-height; I fixed this to use the
actual shift value on the plane.

We also need to pass the SPS and PPS range extension flags.

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

 libavcodec/hevcdec.c|  3 +++
 libavcodec/nvdec.c  | 42 ++
 libavcodec/nvdec_hevc.c | 30 ++
 3 files changed, 67 insertions(+), 8 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index b2a87d55db..967f8f1def 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -409,6 +409,9 @@ static enum AVPixelFormat get_format(HEVCContext *s, const 
HEVCSPS *sps)
 #endif
 break;
 case AV_PIX_FMT_YUV420P12:
+case AV_PIX_FMT_YUV444P:
+case AV_PIX_FMT_YUV444P10:
+case AV_PIX_FMT_YUV444P12:
 #if CONFIG_HEVC_NVDEC_HWACCEL
 *fmt++ = AV_PIX_FMT_CUDA;
 #endif
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index c7d5379770..72201a1123 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -35,6 +35,11 @@
 #include "nvdec.h"
 #include "internal.h"
 
+#if !NVDECAPI_CHECK_VERSION(9, 0)
+#define cudaVideoSurfaceFormat_YUV444 2
+#define cudaVideoSurfaceFormat_YUV444_16Bit 3
+#endif
+
 typedef struct NVDECDecoder {
 CUvideodecoder decoder;
 
@@ -274,7 +279,8 @@ int ff_nvdec_decode_init(AVCodecContext *avctx)
 
 CUVIDDECODECREATEINFO params = { 0 };
 
-int cuvid_codec_type, cuvid_chroma_format;
+cudaVideoSurfaceFormat output_format;
+int cuvid_codec_type, cuvid_chroma_format, chroma_444;
 int ret = 0;
 
 sw_desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
@@ -292,6 +298,7 @@ int ff_nvdec_decode_init(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_ERROR, "Unsupported chroma format\n");
 return AVERROR(ENOSYS);
 }
+chroma_444 = cuvid_chroma_format == cudaVideoChromaFormat_444;
 
 if (!avctx->hw_frames_ctx) {
 ret = ff_decode_get_hw_frames_ctx(avctx, AV_HWDEVICE_TYPE_CUDA);
@@ -299,6 +306,21 @@ int ff_nvdec_decode_init(AVCodecContext *avctx)
 return ret;
 }
 
+switch (sw_desc->comp[0].depth) {
+case 8:
+output_format = chroma_444 ? cudaVideoSurfaceFormat_YUV444 :
+ cudaVideoSurfaceFormat_NV12;
+break;
+case 10:
+case 12:
+output_format = chroma_444 ? cudaVideoSurfaceFormat_YUV444_16Bit :
+ cudaVideoSurfaceFormat_P016;
+break;
+default:
+av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth\n");
+return AVERROR(ENOSYS);
+}
+
 frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
 
 params.ulWidth = avctx->coded_width;
@@ -306,8 +328,7 @@ int ff_nvdec_decode_init(AVCodecContext *avctx)
 params.ulTargetWidth   = avctx->coded_width;
 params.ulTargetHeight  = avctx->coded_height;
 params.bitDepthMinus8  = sw_desc->comp[0].depth - 8;
-params.OutputFormat= params.bitDepthMinus8 ?
- cudaVideoSurfaceFormat_P016 : 
cudaVideoSurfaceFormat_NV12;
+params.OutputFormat= output_format;
 params.CodecType   = cuvid_codec_type;
 params.ChromaFormat= cuvid_chroma_format;
 params.ulNumDecodeSurfaces = frames_ctx->initial_pool_size;
@@ -386,6 +407,8 @@ static int nvdec_retrieve_data(void *logctx, AVFrame *frame)
 NVDECFrame*cf = (NVDECFrame*)fdd->hwaccel_priv;
 NVDECDecoder *decoder = (NVDECDecoder*)cf->decoder_ref->data;
 
+AVHWFramesContext *hwctx = (AVHWFramesContext *)frame->hw_frames_ctx->data;
+
 CUVIDPROCPARAMS vpp = { 0 };
 NVDECFrame *unmap_data = NULL;
 
@@ -394,6 +417,7 @@ static int nvdec_retrieve_data(void *logctx, AVFrame *frame)
 
 unsigned int pitch, i;
 unsigned int offset = 0;
+int shift_h = 0, shift_v = 0;
 int ret = 0;
 
 vpp.progressive_frame = 1;
@@ -427,10 +451,11 @@ static int nvdec_retrieve_data(void *logctx, AVFrame 
*frame)
 unmap_data->idx_ref = av_buffer_ref(cf->idx_ref);
 unmap_data->decoder_ref = av_buffer_ref(cf->decoder_ref);
 
+av_pix_fmt_get_chroma_sub_sample(hwctx->sw_format, &shift_h, &shift_v);
 for (i = 0; frame->linesize[i]; i++) {
 frame->data[i] = (uint8_t*)(devptr + offset);
 frame->linesize[i] = pitch;
-offset += pitch * (frame->height >> (i ? 1 : 0));
+off

[FFmpeg-cvslog] avcodec/cuviddec: Add support for decoding HEVC 4:4:4 content

2019-02-16 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Sun Oct  7 
09:10:00 2018 -0700| [317b7b06fd97cd39feac7df57db22a30550351ff] | committer: 
Philip Langdale

avcodec/cuviddec: Add support for decoding HEVC 4:4:4 content

This is the equivalent change for cuviddec after the previous change
for nvdec. I made similar changes to the copying routines to handle
pixel formats in a more generic way.

Note that unlike with nvdec, there is no confusion about the ability
of a codec to output 444 formats. This is because the cuvid parser is
used, meaning that 444 JPEG content is still indicated as using a 420
output format.

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

 libavcodec/cuviddec.c | 66 +++
 1 file changed, 46 insertions(+), 20 deletions(-)

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index 03589367ce..291bb93dbc 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -34,8 +34,14 @@
 #include "avcodec.h"
 #include "decode.h"
 #include "hwaccel.h"
+#include "nvdec.h"
 #include "internal.h"
 
+#if !NVDECAPI_CHECK_VERSION(9, 0)
+#define cudaVideoSurfaceFormat_YUV444 2
+#define cudaVideoSurfaceFormat_YUV444_16Bit 3
+#endif
+
 typedef struct CuvidContext
 {
 AVClass *avclass;
@@ -106,6 +112,7 @@ static int CUDAAPI cuvid_handle_video_sequence(void 
*opaque, CUVIDEOFORMAT* form
 CUVIDDECODECAPS *caps = NULL;
 CUVIDDECODECREATEINFO cuinfo;
 int surface_fmt;
+int chroma_444;
 
 int old_width = avctx->width;
 int old_height = avctx->height;
@@ -148,17 +155,19 @@ static int CUDAAPI cuvid_handle_video_sequence(void 
*opaque, CUVIDEOFORMAT* form
 cuinfo.target_rect.right = cuinfo.ulTargetWidth;
 cuinfo.target_rect.bottom = cuinfo.ulTargetHeight;
 
+chroma_444 = format->chroma_format == cudaVideoChromaFormat_444;
+
 switch (format->bit_depth_luma_minus8) {
 case 0: // 8-bit
-pix_fmts[1] = AV_PIX_FMT_NV12;
+pix_fmts[1] = chroma_444 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_NV12;
 caps = &ctx->caps8;
 break;
 case 2: // 10-bit
-pix_fmts[1] = AV_PIX_FMT_P010;
+pix_fmts[1] = chroma_444 ? AV_PIX_FMT_YUV444P16 : AV_PIX_FMT_P010;
 caps = &ctx->caps10;
 break;
 case 4: // 12-bit
-pix_fmts[1] = AV_PIX_FMT_P016;
+pix_fmts[1] = chroma_444 ? AV_PIX_FMT_YUV444P16 : AV_PIX_FMT_P016;
 caps = &ctx->caps12;
 break;
 default:
@@ -261,12 +270,6 @@ static int CUDAAPI cuvid_handle_video_sequence(void 
*opaque, CUVIDEOFORMAT* form
 return 0;
 }
 
-if (format->chroma_format != cudaVideoChromaFormat_420) {
-av_log(avctx, AV_LOG_ERROR, "Chroma formats other than 420 are not 
supported\n");
-ctx->internal_error = AVERROR(EINVAL);
-return 0;
-}
-
 ctx->chroma_format = format->chroma_format;
 
 cuinfo.CodecType = ctx->codec_type = format->codec;
@@ -280,8 +283,15 @@ static int CUDAAPI cuvid_handle_video_sequence(void 
*opaque, CUVIDEOFORMAT* form
 case AV_PIX_FMT_P016:
 cuinfo.OutputFormat = cudaVideoSurfaceFormat_P016;
 break;
+case AV_PIX_FMT_YUV444P:
+cuinfo.OutputFormat = cudaVideoSurfaceFormat_YUV444;
+break;
+case AV_PIX_FMT_YUV444P16:
+cuinfo.OutputFormat = cudaVideoSurfaceFormat_YUV444_16Bit;
+break;
 default:
-av_log(avctx, AV_LOG_ERROR, "Output formats other than NV12, P010 or 
P016 are not supported\n");
+av_log(avctx, AV_LOG_ERROR, "Unsupported output format: %s\n",
+   av_get_pix_fmt_name(avctx->sw_pix_fmt));
 ctx->internal_error = AVERROR(EINVAL);
 return 0;
 }
@@ -490,6 +500,7 @@ static int cuvid_output_frame(AVCodecContext *avctx, 
AVFrame *frame)
 return ret;
 
 if (av_fifo_size(ctx->frame_queue)) {
+const AVPixFmtDescriptor *pixdesc;
 CuvidParsedFrame parsed_frame;
 CUVIDPROCPARAMS params;
 unsigned int pitch = 0;
@@ -520,7 +531,10 @@ static int cuvid_output_frame(AVCodecContext *avctx, 
AVFrame *frame)
 goto error;
 }
 
-for (i = 0; i < 2; i++) {
+pixdesc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
+
+for (i = 0; i < pixdesc->nb_components; i++) {
+int height = avctx->height >> (i ? pixdesc->log2_chroma_h : 0);
 CUDA_MEMCPY2D cpy = {
 .srcMemoryType = CU_MEMORYTYPE_DEVICE,
 .dstMemoryType = CU_MEMORYTYPE_DEVICE,
@@ -530,22 +544,25 @@ static int cuvid_output_frame(AVCodecContext *avctx, 
AVFrame *frame)
 .dstPitch  = frame->linesize[i],
 .srcY  = offset,
 .WidthInBytes  = FFMIN(pitch, frame->linesize[i]),
-.Height= avctx->height >> (i ? 1 : 0),
+.Height= height,
 };
 
   

[FFmpeg-cvslog] avcodec/version: Bump micro-version for nvdec/cuviddec changes

2019-02-16 Thread Philip Langdale
ffmpeg | branch: master | Philip Langdale  | Sat Feb 16 
10:40:32 2019 -0800| [d6fc5dc24aa09e026c6271a7565e63798dfe46f3] | committer: 
Philip Langdale

avcodec/version: Bump micro-version for nvdec/cuviddec changes

I forgot to add the version bump and changelog within the changes.

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

 Changelog| 1 +
 libavcodec/version.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index d5515c4911..4d80e5b54f 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,7 @@ version :
 - hcom demuxer and decoder
 - ARBC decoder
 - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
+- Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
 
 
 version 4.1:
diff --git a/libavcodec/version.h b/libavcodec/version.h
index f2f188ea7c..7c3897e2d4 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  47
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

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


[FFmpeg-cvslog] avcodec/mips: [loongson] optimize theora decoding with mmi.

2019-02-16 Thread gxw
ffmpeg | branch: master | gxw  | Tue Feb 12 18:55:48 
2019 +0800| [1466dc140d49d70ce07e03a5aebb21725166045a] | committer: Michael 
Niedermayer

avcodec/mips: [loongson] optimize theora decoding with mmi.

Optimize theora decoding with mmi in functions:
1. ff_vp3_idct_add_mmi
2. ff_vp3_idct_put_mmi
3. ff_vp3_idct_dc_add_mmi
4. ff_put_no_rnd_pixels_l2_mmi

Theora decoding speed improved about 32%(from 88fps to 116fps, Tested on 
loongson 3A3000).

Reviewed-by: Shiyou Yin 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/mips/Makefile   |   1 +
 libavcodec/mips/vp3dsp_idct_mmi.c  | 769 +
 libavcodec/mips/vp3dsp_init_mips.c |  14 +
 libavcodec/mips/vp3dsp_mips.h  |   6 +
 4 files changed, 790 insertions(+)

diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 30298725a3..c827649150 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -87,3 +87,4 @@ MMI-OBJS-$(CONFIG_HPELDSP)+= 
mips/hpeldsp_mmi.o
 MMI-OBJS-$(CONFIG_VC1_DECODER)+= mips/vc1dsp_mmi.o
 MMI-OBJS-$(CONFIG_WMV2DSP)+= mips/wmv2dsp_mmi.o
 MMI-OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_mmi.o
+MMI-OBJS-$(CONFIG_VP3DSP) += mips/vp3dsp_idct_mmi.o
diff --git a/libavcodec/mips/vp3dsp_idct_mmi.c 
b/libavcodec/mips/vp3dsp_idct_mmi.c
new file mode 100644
index 00..c5c4cf3127
--- /dev/null
+++ b/libavcodec/mips/vp3dsp_idct_mmi.c
@@ -0,0 +1,769 @@
+/*
+ * Copyright (c) 2018 gxw 
+ *
+ * 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 "vp3dsp_mips.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mips/mmiutils.h"
+#include "libavutil/common.h"
+#include "libavcodec/rnd_avg.h"
+
+#define LOAD_CONST(dst, value)\
+"li %[tmp1],  "#value"  \n\t" \
+"dmtc1  %[tmp1],  "#dst"\n\t" \
+"pshufh "#dst",   "#dst", %[ftmp10] \n\t"
+
+static void idct_row_mmi(int16_t *input)
+{
+double ftmp[23];
+uint64_t tmp[2];
+__asm__ volatile (
+"xor%[ftmp10],  %[ftmp10],%[ftmp10] \n\t"
+LOAD_CONST(%[csth_1], 1)
+"li %[tmp0],0x02\n\t"
+"1: \n\t"
+/* Load input */
+"ldc1   %[ftmp0],   0x00(%[input])  \n\t"
+"ldc1   %[ftmp1],   0x10(%[input])  \n\t"
+"ldc1   %[ftmp2],   0x20(%[input])  \n\t"
+"ldc1   %[ftmp3],   0x30(%[input])  \n\t"
+"ldc1   %[ftmp4],   0x40(%[input])  \n\t"
+"ldc1   %[ftmp5],   0x50(%[input])  \n\t"
+"ldc1   %[ftmp6],   0x60(%[input])  \n\t"
+"ldc1   %[ftmp7],   0x70(%[input])  \n\t"
+LOAD_CONST(%[ftmp8], 64277)
+LOAD_CONST(%[ftmp9], 12785)
+"pmulhh %[A],   %[ftmp9], %[ftmp7]  \n\t"
+"pcmpgth%[C],   %[ftmp10],%[ftmp1]  \n\t"
+"or %[mask],%[C], %[csth_1] \n\t"
+"pmullh %[B],   %[ftmp1], %[mask]   \n\t"
+"pmulhuh%[B],   %[ftmp8], %[B]  \n\t"
+"pmullh %[B],   %[B], %[mask]   \n\t"
+"paddh  %[A],   %[A], %[B]  \n\t"
+"paddh  %[A],   %[A], %[C]  \n\t"
+"pcmpgth%[D],   %[ftmp10],%[ftmp7]  \n\t"
+"or %[mask],%[D], %[csth_1] \n\t"
+"pmullh %[ftmp7],   %[ftmp7], %[mask]   \n\t"
+"pmulhuh%[B],   %[ftmp8], %[ftmp7]  \n\t"
+"pmullh %[B],   %[B], %[mask]   \n\t"
+"pmulhh %[C],   %[ftmp9], %[ftmp1]  \n\t"
+"psubh  %[B],   %[C], %[B]  \n\t"
+"psubh  %[B],   %[B], %[D]  \n\t"
+
+LOAD_CONST(%[ftmp8], 54491)
+

[FFmpeg-cvslog] avcodec/mpeg4videodec: Clear interlaced_dct for studio profile

2019-02-16 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Feb 15 01:57:09 2019 +0100| [1f686d023b95219db933394a7704ad9aa5f01cbb] | 
committer: Michael Niedermayer

avcodec/mpeg4videodec: Clear interlaced_dct for studio profile

Fixes: Out of array access
Fixes: 
13090/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5408668986638336

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

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

 libavcodec/mpeg4videodec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index f44ee76bd4..ecd028a87c 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3057,6 +3057,7 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, 
GetBitContext *gb)
 return 0;
 
 s->partitioned_frame = 0;
+s->interlaced_dct = 0;
 s->decode_mb = mpeg4_decode_studio_mb;
 
 decode_smpte_tc(ctx, gb);

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


[FFmpeg-cvslog] lavc/libgsmenc: Force mono and use 13k as default bitrate.

2019-02-16 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Sat Feb 16 
20:18:07 2019 +0100| [fe7d8c993ff9b72752ce8cad562fe40b1dc2a7cc] | committer: 
Carl Eugen Hoyos

lavc/libgsmenc: Force mono and use 13k as default bitrate.

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

 libavcodec/libgsmenc.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/libgsmenc.c b/libavcodec/libgsmenc.c
index c9e7ba056e..fdb11c705e 100644
--- a/libavcodec/libgsmenc.c
+++ b/libavcodec/libgsmenc.c
@@ -114,6 +114,10 @@ static int libgsm_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 return 0;
 }
 
+static const AVCodecDefault libgsm_defaults[] = {
+{ "b","13000" },
+{ NULL },
+};
 
 #if CONFIG_LIBGSM_ENCODER
 AVCodec ff_libgsm_encoder = {
@@ -124,6 +128,8 @@ AVCodec ff_libgsm_encoder = {
 .init   = libgsm_encode_init,
 .encode2= libgsm_encode_frame,
 .close  = libgsm_encode_close,
+.defaults   = libgsm_defaults,
+.channel_layouts= (const uint64_t[]) { AV_CH_LAYOUT_MONO, 0 },
 .sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
  AV_SAMPLE_FMT_NONE },
 .wrapper_name   = "libgsm",
@@ -138,6 +144,8 @@ AVCodec ff_libgsm_ms_encoder = {
 .init   = libgsm_encode_init,
 .encode2= libgsm_encode_frame,
 .close  = libgsm_encode_close,
+.defaults   = libgsm_defaults,
+.channel_layouts= (const uint64_t[]) { AV_CH_LAYOUT_MONO, 0 },
 .sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
  AV_SAMPLE_FMT_NONE },
 .wrapper_name   = "libgsm",

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


[FFmpeg-cvslog] doc/muxers: grammar fix

2019-02-16 Thread Reto Kromer
ffmpeg | branch: master | Reto Kromer  | Wed Feb 13 17:03:07 
2019 +0100| [7a51fed0f04718d2f0caf9b990ccee4f4ebce573] | committer: Gyan Doshi

doc/muxers: grammar fix

Signed-off-by: Gyan Doshi 

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

 doc/muxers.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 6a3266ab2e..36010cf2d1 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1523,7 +1523,7 @@ Set the program @samp{service_type}. Default is 
@code{digital_tv}.
 Accepts the following options:
 @table @samp
 @item hex_value
-Any hexadecimal value between @code{0x01} to @code{0xff} as defined in
+Any hexadecimal value between @code{0x01} and @code{0xff} as defined in
 ETSI 300 468.
 @item digital_tv
 Digital TV service.

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


[FFmpeg-cvslog] doc/fftools-common-opts: add example for codec option stream specifiers

2019-02-16 Thread Gyan Doshi
ffmpeg | branch: master | Gyan Doshi  | Sun Feb 17 11:46:31 
2019 +0530| [a9452fe6dc2ecf5b2249aae6d770655095b4e232] | committer: Gyan Doshi

doc/fftools-common-opts: add example for codec option stream specifiers

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

 doc/fftools-common-opts.texi | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index 43c1f4d2d6..f4820fd293 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -365,7 +365,15 @@ ffmpeg -i input.flac -id3v2_version 3 out.mp3
 @end example
 
 All codec AVOptions are per-stream, and thus a stream specifier
-should be attached to them.
+should be attached to them:
+@example
+ffmpeg -i multichannel.mxf -map 0:v:0 -map 0:a:0 -map 0:a:0 -c:a:0 ac3 -b:a:0 
640k -ac:a:1 2 -c:a:1 aac -b:2 128k out.mp4
+@end example
+
+In the above example, a multichannel audio stream is mapped twice for output.
+The first instance is encoded with codec ac3 and bitrate 640k.
+The second instance is downmixed to 2 channels and encoded with codec aac. A 
bitrate of 128k is specified for it using
+absolute index of the output stream.
 
 Note: the @option{-nooption} syntax cannot be used for boolean
 AVOptions, use @option{-option 0}/@option{-option 1}.

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