1 /*
2 * Copyright (c) 2013 Nicolas George
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
28
29 /* Identical to Adler32 when the type is uint8_t. */
30 #define DEFINE_CKSUM_LINE(name, type, conv) \
31 static void cksum_line_ ## name(unsigned *cksum, void *data, unsigned size) \
32 { \
33 type *p = data; \
34 unsigned a = *cksum & 0xFFFF, b = *cksum >> 16; \
35 for (; size > 0; size--, p++) { \
36 a = (a + (unsigned)(conv)) % 65521; \
37 b = (b + a) % 65521; \
38 } \
39 *cksum = a | (b << 16); \
40 }
41
47
49 {
53 int linesize[5] = { 0 };
54
58 return;
59 }
61 return;
63 for (
i = 0; linesize[
i];
i++) {
64 unsigned cksum = 0;
66 if ((
i == 1 ||
i == 2) &&
desc->nb_components >= 3)
69 for (y = 0; y <
h; y++) {
72 }
74 }
75 }
76
78 {
79 int nb_planes, nb_samples, p;
81
82 nb_planes =
frame->channels;
83 nb_samples =
frame->nb_samples;
85 nb_samples *= nb_planes;
86 nb_planes = 1;
87 }
91 for (p = 0; p < nb_planes; p++) {
92 uint32_t cksum = 0;
93 void *
d =
frame->extended_data[p];
94 switch (
frame->format) {
97 cksum_line_u8(&cksum,
d, nb_samples);
98 break;
101 cksum_line_s16(&cksum,
d, nb_samples);
102 break;
105 cksum_line_s32(&cksum,
d, nb_samples);
106 break;
109 cksum_line_flt(&cksum,
d, nb_samples);
110 break;
113 cksum_line_dbl(&cksum,
d, nb_samples);
114 break;
115 default:
117 }
119 }
120 }
121
123 {
125 }
126
129 {
130 AVBPrint bp;
133 const char *type_name;
134
136 return 0;
137
140 stream_index, (*frame)->pts);
141 type =
s->streams[stream_index]->codecpar->codec_type;
143 av_bprintf(&bp,
", %s", type_name ? type_name :
"unknown");
147 break;
150 break;
151 }
152
156 else
160 }
161
163 {
165 }
166
168 .
name =
"uncodedframecrc",
177 };