MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / frame_hash

Function frame_hash

tools/enc_recon_frame_test.c:68–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66} PrivData;
67
68static int frame_hash(FrameChecksum **pc, size_t *nb_c, int64_t ts,
69 const AVFrame *frame)
70{
71 FrameChecksum *c;
72 int shift_h[4] = { 0 }, shift_v[4] = { 0 };
73
74 c = av_realloc_array(*pc, *nb_c + 1, sizeof(*c));
75 if (!c)
76 return AVERROR(ENOMEM);
77 *pc = c;
78 (*nb_c)++;
79
80 c += *nb_c - 1;
81 memset(c, 0, sizeof(*c));
82
83 av_pix_fmt_get_chroma_sub_sample(frame->format, &shift_h[1], &shift_v[1]);
84 shift_h[2] = shift_h[1];
85 shift_v[2] = shift_v[1];
86
87 c->ts = ts;
88 for (int p = 0; frame->data[p]; p++) {
89 const uint8_t *data = frame->data[p];
90 int linesize = av_image_get_linesize(frame->format, frame->width, p);
91 uint32_t checksum = 0;
92
93 av_assert0(linesize >= 0);
94
95 for (int j = 0; j < frame->height >> shift_v[p]; j++) {
96 checksum = av_adler32_update(checksum, data, linesize);
97 data += frame->linesize[p];
98 }
99
100 c->checksum[p] = checksum;
101 }
102
103 return 0;
104}
105
106static int recon_frame_process(PrivData *pd, const AVPacket *pkt)
107{

Callers 2

recon_frame_processFunction · 0.85
process_frameFunction · 0.85

Calls 4

av_realloc_arrayFunction · 0.85
av_image_get_linesizeFunction · 0.85
av_adler32_updateFunction · 0.85

Tested by

no test coverage detected