52 static uint64_t frame_cnt = 0;
57 fprintf(stderr,
"Error sending a packet for decoding: %s\n",
av_err2str(ret));
70 fprintf(stderr,
"Error during decoding: %s\n",
av_err2str(ret));
76 "#format: frame checksums\n"
80 "#media_type 0: video\n"
81 "#codec_id 0: rawvideo\n"
82 "#dimensions 0: 352x288\n"
84 "#stream#, dts, pts, duration, size, hash\n");
93 for (
int i = 0;
i <
frame->height;
i++)
95 for (
int i = 0;
i <
frame->height >>
desc->log2_chroma_h;
i++)
97 for (
int i = 0;
i <
frame->height >>
desc->log2_chroma_h;
i++)
101 printf(
"0, %10"PRId64
", %10"PRId64
", 1, %8d, %s\n",
102 frame_cnt, frame_cnt,
115 unsigned int threads;
119 int nals = 0, ret = 0;
123 fprintf(stderr,
"Usage: %s <threads> <input file>\n", argv[0]);
127 if (!(threads = strtoul(argv[1],
NULL, 0)))
146 fprintf(stderr,
"Codec not found\n");
152 fprintf(stderr,
"Could not allocate video codec context\n");
162 c->thread_count = threads;
165 fprintf(stderr,
"Could not open codec\n");
171 fprintf(stderr,
"Couldn't activate slice threading: %d\n",
c->active_thread_type);
176 fprintf(stderr,
"WARN: not using threads, only checking decoding slice NALUs\n");
180 fprintf(stderr,
"Could not allocate video frame\n");
185 if (!(file = fopen(argv[2],
"rb"))) {
186 fprintf(stderr,
"Couldn't open NALU file: %s\n", argv[2]);
193 size_t ret = fread(&
size, 1,
sizeof(uint16_t), file);
194 if (ret !=
sizeof(uint16_t))
198 ret = fread(p, 1,
size, file);
200 perror(
"Couldn't read data");
205 if (++nals >= threads) {
static int decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt)
static uint8_t hash[HASH_SIZE]
Libavcodec external API header.
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
#define i(width, name, range_min, range_max)
static int FUNC nal(CodedBitstreamContext *ctx, RWContext *rw, LCEVCRawNAL *current, int nal_unit_type)
__device__ int printf(const char *,...)
static AVCodecContext * dec_ctx
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.
#define AV_CODEC_FLAG2_CHUNKS
Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
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.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
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_hash_freep(AVHashContext **ctx)
Free hash context and set hash context pointer to NULL.
void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size)
Finalize a hash context and store the hexadecimal representation of the actual hash value as a string...
void av_hash_init(AVHashContext *ctx)
Initialize or reset a hash context.
void av_hash_update(AVHashContext *ctx, const uint8_t *src, size_t len)
Update a hash context with additional data.
int av_hash_alloc(AVHashContext **ctx, const char *name)
Allocate a hash context for the algorithm specified by name.
#define AV_HASH_MAX_SIZE
Maximum value that av_hash_get_size() will currently return.
int av_hash_get_size(const AVHashContext *ctx)
Memory handling functions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static const uint8_t header[24]
main external API structure.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...