libavcodec/dnxhd: add dnxhr profiles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/228/head
Mark Reid 9 years ago committed by Michael Niedermayer
parent a06acfff76
commit 41d7642a7b
  1. 7
      libavcodec/avcodec.h
  2. 1
      libavcodec/codec_desc.c
  3. 22
      libavcodec/dnxhddec.c
  4. 2
      libavcodec/dnxhdenc.c
  5. 10
      libavcodec/profiles.c
  6. 1
      libavcodec/profiles.h

@ -3173,6 +3173,13 @@ typedef struct AVCodecContext {
#define FF_PROFILE_MPEG2_AAC_LOW 128 #define FF_PROFILE_MPEG2_AAC_LOW 128
#define FF_PROFILE_MPEG2_AAC_HE 131 #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 20
#define FF_PROFILE_DTS_ES 30 #define FF_PROFILE_DTS_ES 30
#define FF_PROFILE_DTS_96_24 40 #define FF_PROFILE_DTS_96_24 40

@ -665,6 +665,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "dnxhd", .name = "dnxhd",
.long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
.profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
}, },
{ {
.id = AV_CODEC_ID_THP, .id = AV_CODEC_ID_THP,

@ -33,6 +33,7 @@
#include "dnxhddata.h" #include "dnxhddata.h"
#include "idctdsp.h" #include "idctdsp.h"
#include "internal.h" #include "internal.h"
#include "profiles.h"
#include "thread.h" #include "thread.h"
typedef struct RowContext { typedef struct RowContext {
@ -159,6 +160,23 @@ static av_cold int dnxhd_decode_init_thread_copy(AVCodecContext *avctx)
return 0; 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, static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
const uint8_t *buf, int buf_size, const uint8_t *buf, int buf_size,
int first_field) int first_field)
@ -204,6 +222,9 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
} }
cid = AV_RB32(buf + 0x28); cid = AV_RB32(buf + 0x28);
ctx->avctx->profile = dnxhd_get_profile(cid);
if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0) if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)
return ret; return ret;
if (ctx->mbaff && ctx->cid_table->cid != 1260) 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 | .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS, AV_CODEC_CAP_SLICE_THREADS,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(dnxhd_decode_init_thread_copy), .init_thread_copy = ONLY_IF_THREADS_ENABLED(dnxhd_decode_init_thread_copy),
.profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
}; };

@ -34,6 +34,7 @@
#include "internal.h" #include "internal.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "pixblockdsp.h" #include "pixblockdsp.h"
#include "profiles.h"
#include "dnxhdenc.h" #include "dnxhdenc.h"
// The largest value that will not lead to overflow for 10-bit samples. // 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, .priv_class = &dnxhd_class,
.defaults = dnxhd_defaults, .defaults = dnxhd_defaults,
.profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
}; };

@ -46,6 +46,16 @@ const AVProfile ff_dca_profiles[] = {
{ FF_PROFILE_UNKNOWN }, { 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[] = { const AVProfile ff_h264_profiles[] = {
{ FF_PROFILE_H264_BASELINE, "Baseline" }, { FF_PROFILE_H264_BASELINE, "Baseline" },
{ FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" }, { FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" },

@ -23,6 +23,7 @@
extern const AVProfile ff_aac_profiles[]; extern const AVProfile ff_aac_profiles[];
extern const AVProfile ff_dca_profiles[]; extern const AVProfile ff_dca_profiles[];
extern const AVProfile ff_dnxhd_profiles[];
extern const AVProfile ff_h264_profiles[]; extern const AVProfile ff_h264_profiles[];
extern const AVProfile ff_hevc_profiles[]; extern const AVProfile ff_hevc_profiles[];
extern const AVProfile ff_jpeg2000_profiles[]; extern const AVProfile ff_jpeg2000_profiles[];

Loading…
Cancel
Save