53 return (
data[21] & 3) + 1;
66 uint8_t dv_profile = 7;
68 for (
int i = 0;
i <
ctx->par_out->nb_coded_side_data;
i++) {
74 cfg->bl_present_flag &= keep_bl;
75 cfg->el_present_flag &= keep_el;
76 cfg->rpu_present_flag &= keep_rpu;
77 dv_profile =
cfg->dv_profile;
84 ctx->par_out->nb_coded_side_data,
86 if (sd && sd->
size >= 23) {
92 ctx->par_out->extradata = new_ed;
93 ctx->par_out->extradata_size = sd->
size;
97 static const uint8_t el_div[] = {
104 int div = dv_profile <
FF_ARRAY_ELEMS(el_div) ? el_div[dv_profile] : 0;
109 if (dv_profile == 7 &&
ctx->par_in->width <= 1920)
112 ctx->par_out->width =
ctx->par_in->width / div;
113 ctx->par_out->height =
ctx->par_in->height / div;
120 &
ctx->par_out->nb_coded_side_data,
124 ctx->par_in->extradata_size);
126 ctx->par_out->extradata_size);
138 const uint8_t **payload,
int *payload_size)
147 if (!keep_el ||
nal->raw_size <= 2)
149 *payload =
nal->raw_data + 2;
150 *payload_size =
nal->raw_size - 2;
156 *payload =
nal->raw_data;
157 *payload_size =
nal->raw_size;
163 *payload =
nal->raw_data;
164 *payload_size =
nal->raw_size;
179 int prefix_size =
s->out_nal_length_size ?
s->out_nal_length_size : 4;
191 for (
int i = 0;
i <
s->pkt.nb_nals;
i++) {
192 const uint8_t *payload;
196 out_size += prefix_size + payload_size;
212 for (
int i = 0;
i <
s->pkt.nb_nals;
i++) {
213 const uint8_t *payload;
217 switch (
s->out_nal_length_size) {
219 case 1:
AV_WB8 (
dst, payload_size);
break;
225 memcpy(
dst, payload, payload_size);
243 if (ret < 0 && ret !=
AVERROR(EAGAIN))
248#define OFFSET(x) offsetof(DOVISplitContext, x)
249#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_BSF_PARAM)
260 .class_name =
"dovi_split_bsf",
271 .p.name =
"dovi_split",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static av_cold void close(AVCodecParserContext *s)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
const FFBitStreamFilter ff_dovi_split_bsf
int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
Called by the bitstream filters to get the next packet for filtering.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static int FUNC nal(CodedBitstreamContext *ctx, RWContext *rw, LCEVCRawNAL *current, int nal_unit_type)
static int nal_is_kept(const DOVISplitContext *s, const H2645NAL *nal, const uint8_t **payload, int *payload_size)
static int dovi_split_init(AVBSFContext *ctx)
static int hvcc_nal_length_size(const uint8_t *data, int size)
static enum AVCodecID dovi_split_codec_ids[]
static const AVOption dovi_split_options[]
static const AVClass dovi_split_class
static void dovi_split_close(AVBSFContext *ctx)
static int dovi_split_filter(AVBSFContext *ctx, AVPacket *out)
int(* init)(AVBSFContext *ctx)
static CheckasmConfig cfg
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
void av_packet_side_data_remove(AVPacketSideData *sd, int *pnb_sd, enum AVPacketSideDataType type)
Remove side data of the given type from a side data array.
const AVPacketSideData * av_packet_side_data_get(const AVPacketSideData *sd, int nb_sd, enum AVPacketSideDataType type)
Get side information from a side data array.
@ AV_PKT_DATA_HEVC_CONF
Dolby Vision enhancement-layer HEVC decoder configuration.
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
#define AV_LOG_WARNING
Something somehow does not look correct.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
@ H2645_FLAG_SMALL_PADDING
void ff_h2645_packet_uninit(H2645Packet *pkt)
Free all the allocated memory in the packet.
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, void *logctx, int nal_length_size, enum AVCodecID codec_id, int flags)
Split an input packet into NAL units.
Memory handling functions.
#define FF_ARRAY_ELEMS(a)
The bitstream filter state.
A reference to a data buffer.
uint8_t * data
The data buffer.
Describe the class of an AVClass context structure.
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
enum AVPacketSideDataType type
This structure stores compressed data.
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static AVFormatContext * ctx