[FFmpeg-cvslog] libavcodec/dnxhd: add dnxhr profiles
Mark Reid
git at videolan.org
Wed Jul 20 15:56:24 EEST 2016
ffmpeg | branch: master | Mark Reid <mindmark at gmail.com> | Sat Jul 16 19:37:37 2016 -0700| [41d7642a7be5ad778788042e5f3769868da09d31] | committer: Michael Niedermayer
libavcodec/dnxhd: add dnxhr profiles
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41d7642a7be5ad778788042e5f3769868da09d31
---
libavcodec/avcodec.h | 7 +++++++
libavcodec/codec_desc.c | 1 +
libavcodec/dnxhddec.c | 22 ++++++++++++++++++++++
libavcodec/dnxhdenc.c | 2 ++
libavcodec/profiles.c | 10 ++++++++++
libavcodec/profiles.h | 1 +
6 files changed, 43 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e52b2f8..ca8dba8 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3173,6 +3173,13 @@ typedef struct AVCodecContext {
#define FF_PROFILE_MPEG2_AAC_LOW 128
#define FF_PROFILE_MPEG2_AAC_HE 131
+#define FF_PROFILE_DNXHD 0
+#define FF_PROFILE_DNXHR_LB 1
+#define FF_PROFILE_DNXHR_SQ 2
+#define FF_PROFILE_DNXHR_HQ 3
+#define FF_PROFILE_DNXHR_HQX 4
+#define FF_PROFILE_DNXHR_444 5
+
#define FF_PROFILE_DTS 20
#define FF_PROFILE_DTS_ES 30
#define FF_PROFILE_DTS_96_24 40
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 7a2230f..dea17c9 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -665,6 +665,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "dnxhd",
.long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ .profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
},
{
.id = AV_CODEC_ID_THP,
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 5b60326..627bc3b 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -33,6 +33,7 @@
#include "dnxhddata.h"
#include "idctdsp.h"
#include "internal.h"
+#include "profiles.h"
#include "thread.h"
typedef struct RowContext {
@@ -159,6 +160,23 @@ static av_cold int dnxhd_decode_init_thread_copy(AVCodecContext *avctx)
return 0;
}
+static int dnxhd_get_profile(int cid)
+{
+ switch(cid) {
+ case 1270:
+ return FF_PROFILE_DNXHR_444;
+ case 1271:
+ return FF_PROFILE_DNXHR_HQX;
+ case 1272:
+ return FF_PROFILE_DNXHR_HQ;
+ case 1273:
+ return FF_PROFILE_DNXHR_SQ;
+ case 1274:
+ return FF_PROFILE_DNXHR_LB;
+ }
+ return FF_PROFILE_DNXHD;
+}
+
static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
const uint8_t *buf, int buf_size,
int first_field)
@@ -204,6 +222,9 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
}
cid = AV_RB32(buf + 0x28);
+
+ ctx->avctx->profile = dnxhd_get_profile(cid);
+
if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)
return ret;
if (ctx->mbaff && ctx->cid_table->cid != 1260)
@@ -692,4 +713,5 @@ AVCodec ff_dnxhd_decoder = {
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(dnxhd_decode_init_thread_copy),
+ .profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
};
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index aee4323..1362514 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -34,6 +34,7 @@
#include "internal.h"
#include "mpegvideo.h"
#include "pixblockdsp.h"
+#include "profiles.h"
#include "dnxhdenc.h"
// The largest value that will not lead to overflow for 10-bit samples.
@@ -1170,4 +1171,5 @@ AVCodec ff_dnxhd_encoder = {
},
.priv_class = &dnxhd_class,
.defaults = dnxhd_defaults,
+ .profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
};
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index 0984704..30498ef 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -46,6 +46,16 @@ const AVProfile ff_dca_profiles[] = {
{ FF_PROFILE_UNKNOWN },
};
+const AVProfile ff_dnxhd_profiles[] = {
+ { FF_PROFILE_DNXHD, "DNXHD"},
+ { FF_PROFILE_DNXHR_LB, "DNXHR LB"},
+ { FF_PROFILE_DNXHR_SQ, "DNXHR SQ"},
+ { FF_PROFILE_DNXHR_HQ, "DNXHR HQ" },
+ { FF_PROFILE_DNXHR_HQX, "DNXHR HQX"},
+ { FF_PROFILE_DNXHR_444, "DNXHR 444"},
+ { FF_PROFILE_UNKNOWN },
+};
+
const AVProfile ff_h264_profiles[] = {
{ FF_PROFILE_H264_BASELINE, "Baseline" },
{ FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" },
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index c86c683..eb18b40 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -23,6 +23,7 @@
extern const AVProfile ff_aac_profiles[];
extern const AVProfile ff_dca_profiles[];
+extern const AVProfile ff_dnxhd_profiles[];
extern const AVProfile ff_h264_profiles[];
extern const AVProfile ff_hevc_profiles[];
extern const AVProfile ff_jpeg2000_profiles[];
More information about the ffmpeg-cvslog
mailing list