Thanks to visit codestin.com
Credit goes to www.ffmpeg.org
FFmpeg
libavutil
crc_internal.h
Go to the documentation of this file.
1
/*
2
* This file is part of FFmpeg.
3
*
4
* FFmpeg is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* FFmpeg is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with FFmpeg; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
#ifndef AVUTIL_CRC_INTERNAL_H
20
#define AVUTIL_CRC_INTERNAL_H
21
22
#include <stdint.h>
23
#include "
libavutil/reverse.h
"
24
25
static
uint64_t
reverse
(uint64_t
p
,
unsigned
int
deg)
26
{
27
uint64_t
ret
= 0;
28
int
i
;
29
for
(
i
= 0;
i
< (deg / 8);
i
+= 1) {
30
ret
= (
ret
<< 8) | (
ff_reverse
[
p
& 0xff]);
31
p
>>= 8;
32
}
33
int
rem = (deg + 1) - 8 *
i
;
34
ret
= (
ret
<< rem) | (
ff_reverse
[
p
& 0xff] >> (8 - rem));
35
return
ret
;
36
}
37
38
static
uint64_t
xnmodp
(
unsigned
n, uint64_t poly,
unsigned
deg, uint64_t *div,
int
bitreverse)
39
{
40
uint64_t
mod
,
mask
,
high
;
41
42
if
(n < deg) {
43
*div = 0;
44
return
poly;
45
}
46
mask
= ((uint64_t)1 << deg) - 1;
47
poly &=
mask
;
48
mod
= poly;
49
*div = 1;
50
deg--;
51
while
(--n > deg) {
52
high
= (
mod
>> deg) & 1;
53
*div = (*div << 1) |
high
;
54
mod
<<= 1;
55
if
(
high
)
56
mod
^= poly;
57
}
58
uint64_t
ret
=
mod
&
mask
;
59
if
(bitreverse) {
60
*div =
reverse
(*div, deg) << 1;
61
return
reverse
(
ret
, deg) << 1;
62
}
63
return
ret
;
64
}
65
66
#endif
/* AVUTIL_CRC_INTERNAL_H */
mask
int mask
Definition:
mediacodecdec_common.c:154
xnmodp
static uint64_t xnmodp(unsigned n, uint64_t poly, unsigned deg, uint64_t *div, int bitreverse)
Definition:
crc_internal.h:38
ff_reverse
const uint8_t ff_reverse[256]
Definition:
reverse.c:23
high
int high
Definition:
dovi_rpuenc.c:39
reverse.h
i
#define i(width, name, range_min, range_max)
Definition:
cbs_h264.c:63
mod
static int mod(int a, int b)
Modulo operation with only positive remainders.
Definition:
vf_v360.c:755
ret
ret
Definition:
filter_design.txt:187
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition:
vsrc_gfxcapture_winrt.hpp:53
reverse
static uint64_t reverse(uint64_t p, unsigned int deg)
Definition:
crc_internal.h:25
Generated on Tue May 12 2026 19:23:38 for FFmpeg by
1.8.17