36 0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x03, 0x70,
37 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03,
38 0x00, 0x00, 0x03, 0x00, 0x1e, 0x95, 0x94, 0x09
42 0x42, 0x01, 0x01, 0x03, 0x70, 0x00, 0x00, 0x03,
43 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03,
44 0x00, 0x1e, 0xa0, 0x20, 0x81, 0x05, 0x96, 0x56,
45 0x54, 0xa4, 0xc2, 0xe0, 0x10, 0x00, 0x00, 0x3e,
46 0x80, 0x00, 0x00, 0x3e, 0x80, 0x80
52 0x42, 0x01, 0x01, 0x03, 0x70, 0x00, 0x00, 0x03,
53 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03,
54 0x00, 0x1e, 0x48, 0x08, 0x20, 0x41, 0x65, 0x95,
55 0x95, 0x29, 0x30, 0xb8, 0x04, 0x00, 0x00, 0x0f,
56 0xa0, 0x00, 0x00, 0x0f, 0xa0, 0x20
61 0x44, 0x01, 0xc0, 0x73, 0xc0, 0x89
66 0x44, 0x01, 0x50, 0x1c, 0xf0, 0x22, 0x40
71 0x4e, 0x01, 0x03, 0x01, 0xff, 0x80
81 0x28, 0x01, 0xac, 0x4e, 0xd7, 0x1f, 0xff, 0xf5,
82 0xde, 0x9c, 0xaf, 0xea, 0xf8
110 for (
int i = 0;
i <
pkt->size;
i++)
121 for (
int i = 0;
i < nb_arrays;
i++)
122 total += 3 + (
size_t)arrays[
i].
count * (2 + arrays[
i].
size);
133 for (
int i = 0;
i < nb_arrays;
i++) {
134 int cnt = arrays[
i].
count;
137 *p++ = arrays[
i].
type & 0x3f;
138 *p++ = (cnt >> 8) & 0xff;
140 for (
int j = 0; j < cnt; j++) {
141 *p++ = (
len >> 8) & 0xff;
146 memset(p, 0x80,
len);
151 *hvcc_size = p - buf;
157 const uint8_t *nalus[],
const size_t lens[],
int count)
163 for (
int i = 0;
i < count;
i++)
164 total += 4 + lens[
i];
171 for (
int i = 0;
i < count;
i++) {
173 memcpy(p + 4, nalus[
i], lens[
i]);
186 int ret = 0, got_frame = 0;
189 fprintf(stderr,
"HEVC decoder not found\n");
235 printf(
"Decoded frames: %d\n", got_frame);
246 const uint8_t *hvcc,
size_t hvcc_size,
255 printf(
"=== Test: %s ===\n", case_name);
259 fprintf(stderr,
"Bitstream filter hevc_mp4toannexb not found\n");
270 if (!
ctx->par_in->extradata) {
274 ctx->par_in->extradata_size = hvcc_size;
278 printf(
"av_bsf_init: %d\n", ret);
281 }
else if (ret < 0) {
284 fprintf(stderr,
"av_bsf_init failed: %s\n", errbuf);
296 fprintf(stderr,
"av_bsf_send_packet failed: %d\n", ret);
302 fprintf(stderr,
"av_bsf_receive_packet failed: %d\n", ret);
311 fprintf(stderr,
"%s: decoding output packet failed\n", case_name);
327 uint8_t *hvcc_std =
NULL, *hvcc_sei =
NULL, *hvcc_dup =
NULL, *hvcc_limit =
NULL;
328 size_t sz_std = 0, sz_sei = 0, sz_dup = 0, sz_limit = 0;
360 if (!hvcc_std || !hvcc_sei || !hvcc_dup || !hvcc_limit) {
373 err =
run_test_case(
"Case 1 (Standard Insertion)", hvcc_std, sz_std,
pkt, 0, 1);
387 err =
run_test_case(
"Case 2 (Exact Payload Deduplication)", hvcc_std, sz_std,
pkt, 0, 1);
401 err =
run_test_case(
"Case 3 (Fairy Counterexample - Retain PPS 0)", hvcc_std, sz_std,
pkt, 0, 1);
415 err =
run_test_case(
"Case 4 (Filler SEI Preservation)", hvcc_sei, sz_sei,
pkt, 0, 1);
423 const uint8_t *nalus[36];
433 for (
int k = 0; k < 32; k++) {
448 err =
run_test_case(
"Case 5 (Many Nonmatching In-band PPS Copies)", hvcc_std, sz_std,
pkt, 0, 1);
466 err =
run_test_case(
"Case 6 (Duplicate Extradata PS Suppressed By In-Band Match)",
467 hvcc_dup, sz_dup,
pkt, 0, 1);
474 err =
run_test_case(
"Case 7 (Exceeds MAX_EXTRADATA_NALS Limit Rejection)",
475 hvcc_limit, sz_limit,
NULL, 1, 0);
490 err =
run_test_case(
"Case 8 (Leading Prefix SEI Before Matching VPS/SPS)",
491 hvcc_std, sz_std,
pkt, 0, 1);
508 err =
run_test_case(
"Case 9 (In-band PPS Before SPS Reordering)",
509 hvcc_std, sz_std,
pkt, 0, 1);
527 err =
run_test_case(
"Case 10 (Leading Prefix SEI With Matching VPS Only)",
528 hvcc_std, sz_std,
pkt, 0, 1);
548 err =
run_test_case(
"Case 11 (Multiple SPS IDs Across Prefix SEI)",
549 hvcc_std, sz_std,
pkt, 0, 1);
static int build_packet(AVPacket *pkt, const uint8_t *nalus[], const size_t lens[], int count)
static const uint8_t prefix_sei_bytes[]
static const uint8_t sps1_bytes[]
static int decode_packet(const AVPacket *pkt)
static const uint8_t idr_slice_bytes[]
static uint8_t * build_hvcc(size_t *hvcc_size, const HVCCNALDesc *arrays, int nb_arrays)
static const uint8_t vps_bytes[]
static const uint8_t dummy_sei_bytes[]
static int run_test_case(const char *case_name, const uint8_t *hvcc, size_t hvcc_size, AVPacket *in_pkt, int init_only, int check_decode)
static void print_packet_hex(const char *label, const AVPacket *pkt)
static const uint8_t pps1_bytes[]
static const uint8_t sps_bytes[]
static const uint8_t pps0_bytes[]
static const uint8_t hvcc_header[22]
static AVFormatContext * ctx
Libavcodec external API header.
#define i(width, name, range_min, range_max)
__device__ int printf(const char *,...)
static AVCodecContext * dec_ctx
static av_cold void cleanup(FlashSV2Context *s)
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Alias for avcodec_receive_frame_flags(avctx, frame, 0).
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
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.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
#define AV_ERROR_MAX_STRING_SIZE
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
#define AVERROR_EOF
End of file.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
Utility Preprocessor macros.
Memory handling functions.
#define FF_ARRAY_ELEMS(a)
The bitstream filter state.
main external API structure.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.