40 #include <sys/types.h>
54 static uint64_t frame_cnt = 0;
59 fprintf(stderr,
"Error sending a packet for decoding: %s\n",
av_err2str(ret));
72 fprintf(stderr,
"Error during decoding: %s\n",
av_err2str(ret));
78 "#format: frame checksums\n"
82 "#media_type 0: video\n"
83 "#codec_id 0: rawvideo\n"
84 "#dimensions 0: 352x288\n"
86 "#stream#, dts, pts, duration, size, hash\n");
95 for (
int i = 0; i < frame->
height; i++)
103 printf(
"0, %10"PRId64
", %10"PRId64
", 1, %8d, %s\n",
104 frame_cnt, frame_cnt,
112 int main(
int argc,
char **argv)
117 unsigned int threads;
121 int nals = 0, ret = 0;
125 fprintf(stderr,
"Usage: %s <threads> <input file> <output file>\n", argv[0]);
129 if (!(threads = strtoul(argv[1],
NULL, 0)))
143 fprintf(stderr,
"Codec not found\n");
149 fprintf(stderr,
"Could not allocate video codec context\n");
162 fprintf(stderr,
"Could not open codec\n");
173 fprintf(stderr,
"WARN: not using threads, only checking decoding slice NALUs\n");
177 fprintf(stderr,
"Could not allocate video frame\n");
182 if (!(file = fopen(argv[2],
"rb"))) {
183 fprintf(stderr,
"Couldn't open NALU file: %s\n", argv[2]);
190 size_t ret = fread(&size, 1,
sizeof(uint16_t), file);
191 if (ret !=
sizeof(uint16_t))
195 ret = fread(p, 1, size, file);
197 perror(
"Couldn't read data");
202 if (++nals >= threads) {
206 if ((decret =
decode(c, frame, pkt)) < 0) {
218 if ((ret =
decode(c, frame, pkt)) < 0) {
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_CODEC_FLAG2_CHUNKS
Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries...
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
#define AV_HASH_MAX_SIZE
Maximum value that av_hash_get_size() will currently return.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AVERROR_EOF
End of file.
void av_hash_init(AVHashContext *ctx)
Initialize or reset a hash context.
static int decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int active_thread_type
Which multithreading methods are in use by the codec.
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder.
int av_hash_alloc(AVHashContext **ctx, const char *name)
Allocate a hash context for the algorithm specified by name.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int width
picture width / height.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
Libavcodec external API header.
int av_hash_get_size(const AVHashContext *ctx)
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer...
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
void av_hash_update(AVHashContext *ctx, const uint8_t *src, int len)
Update a hash context with additional data.
void av_hash_freep(AVHashContext **ctx)
Free hash context and set hash context pointer to NULL.
int main(int argc, char **argv)
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...
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static AVCodecContext * dec_ctx
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int flags2
AV_CODEC_FLAG2_*.
This structure stores compressed data.
int thread_type
Which multithreading methods to use.