Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
3b08d9d9
Commit
3b08d9d9
authored
Mar 21, 2016
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testprogs: K&R formatting cosmetics
parent
43992985
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
48 deletions
+66
-48
iirfilter.c
libavcodec/iirfilter.c
+0
-0
rangecoder.c
libavcodec/rangecoder.c
+1
-1
aes.c
libavutil/aes.c
+19
-18
crc.c
libavutil/crc.c
+9
-7
des.c
libavutil/des.c
+0
-0
lls.c
libavutil/lls.c
+1
-1
md5.c
libavutil/md5.c
+36
-21
opt.c
libavutil/opt.c
+0
-0
No files found.
libavcodec/iirfilter.c
View file @
3b08d9d9
This diff is collapsed.
Click to expand it.
libavcodec/rangecoder.c
View file @
3b08d9d9
...
...
@@ -55,7 +55,7 @@ av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf,
/* cast to avoid compiler warning */
ff_init_range_encoder
(
c
,
(
uint8_t
*
)
buf
,
buf_size
);
c
->
low
=
AV_RB16
(
c
->
bytestream
);
c
->
low
=
AV_RB16
(
c
->
bytestream
);
c
->
bytestream
+=
2
;
}
...
...
libavutil/aes.c
View file @
3b08d9d9
...
...
@@ -21,9 +21,9 @@
*/
#include "common.h"
#include "aes.h"
#include "intreadwrite.h"
#include "timer.h"
#include "aes.h"
typedef
union
{
uint64_t
u64
[
2
];
...
...
@@ -46,7 +46,7 @@ struct AVAES *av_aes_alloc(void)
}
static
const
uint8_t
rcon
[
10
]
=
{
0x01
,
0x02
,
0x04
,
0x08
,
0x10
,
0x20
,
0x40
,
0x80
,
0x1b
,
0x36
0x01
,
0x02
,
0x04
,
0x08
,
0x10
,
0x20
,
0x40
,
0x80
,
0x1b
,
0x36
};
static
uint8_t
sbox
[
256
];
...
...
@@ -109,7 +109,8 @@ static void subshift(av_aes_block s0[2], int s, const uint8_t *box)
s3
[
0
].
u8
[
5
]
=
box
[
s3
[
1
].
u8
[
1
]];
}
static
inline
int
mix_core
(
uint32_t
multbl
[][
256
],
int
a
,
int
b
,
int
c
,
int
d
){
static
inline
int
mix_core
(
uint32_t
multbl
[][
256
],
int
a
,
int
b
,
int
c
,
int
d
)
{
#if CONFIG_SMALL
return
multbl
[
0
][
a
]
^
ROT
(
multbl
[
0
][
b
],
8
)
^
ROT
(
multbl
[
0
][
c
],
16
)
^
ROT
(
multbl
[
0
][
d
],
24
);
#else
...
...
@@ -117,12 +118,13 @@ static inline int mix_core(uint32_t multbl[][256], int a, int b, int c, int d){
#endif
}
static
inline
void
mix
(
av_aes_block
state
[
2
],
uint32_t
multbl
[][
256
],
int
s1
,
int
s3
){
static
inline
void
mix
(
av_aes_block
state
[
2
],
uint32_t
multbl
[][
256
],
int
s1
,
int
s3
)
{
uint8_t
(
*
src
)[
4
]
=
state
[
1
].
u8x4
;
state
[
0
].
u32
[
0
]
=
mix_core
(
multbl
,
src
[
0
][
0
],
src
[
s1
][
1
],
src
[
2
][
2
],
src
[
s3
][
3
]);
state
[
0
].
u32
[
1
]
=
mix_core
(
multbl
,
src
[
1
][
0
],
src
[
s3
-
1
][
1
],
src
[
3
][
2
],
src
[
s1
-
1
][
3
]);
state
[
0
].
u32
[
2
]
=
mix_core
(
multbl
,
src
[
2
][
0
],
src
[
s3
][
1
],
src
[
0
][
2
],
src
[
s1
][
3
]);
state
[
0
].
u32
[
3
]
=
mix_core
(
multbl
,
src
[
3
][
0
],
src
[
s1
-
1
][
1
],
src
[
1
][
2
],
src
[
s3
-
1
][
3
]);
state
[
0
].
u32
[
0
]
=
mix_core
(
multbl
,
src
[
0
][
0
],
src
[
s1
][
1
],
src
[
2
][
2
],
src
[
s3
][
3
]);
state
[
0
].
u32
[
1
]
=
mix_core
(
multbl
,
src
[
1
][
0
],
src
[
s3
-
1
][
1
],
src
[
3
][
2
],
src
[
s1
-
1
][
3
]);
state
[
0
].
u32
[
2
]
=
mix_core
(
multbl
,
src
[
2
][
0
],
src
[
s3
][
1
],
src
[
0
][
2
],
src
[
s1
][
3
]);
state
[
0
].
u32
[
3
]
=
mix_core
(
multbl
,
src
[
3
][
0
],
src
[
s1
-
1
][
1
],
src
[
1
][
2
],
src
[
s3
-
1
][
3
]);
}
static
inline
void
crypt
(
AVAES
*
a
,
int
s
,
const
uint8_t
*
sbox
,
...
...
@@ -178,7 +180,7 @@ static void init_multbl2(uint32_t tbl[][256], const int c[4],
l
=
alog8
[
x
+
log8
[
c
[
1
]]];
m
=
alog8
[
x
+
log8
[
c
[
2
]]];
n
=
alog8
[
x
+
log8
[
c
[
3
]]];
tbl
[
0
][
i
]
=
AV_NE
(
MKBETAG
(
k
,
l
,
m
,
n
),
MKTAG
(
k
,
l
,
m
,
n
));
tbl
[
0
][
i
]
=
AV_NE
(
MKBETAG
(
k
,
l
,
m
,
n
),
MKTAG
(
k
,
l
,
m
,
n
));
#if !CONFIG_SMALL
tbl
[
1
][
i
]
=
ROT
(
tbl
[
0
][
i
],
8
);
tbl
[
2
][
i
]
=
ROT
(
tbl
[
0
][
i
],
16
);
...
...
@@ -198,7 +200,7 @@ int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
uint8_t
log8
[
256
];
uint8_t
alog8
[
512
];
if
(
!
enc_multbl
[
FF_ARRAY_ELEMS
(
enc_multbl
)
-
1
][
FF_ARRAY_ELEMS
(
enc_multbl
[
0
])
-
1
])
{
if
(
!
enc_multbl
[
FF_ARRAY_ELEMS
(
enc_multbl
)
-
1
][
FF_ARRAY_ELEMS
(
enc_multbl
[
0
])
-
1
])
{
j
=
1
;
for
(
i
=
0
;
i
<
255
;
i
++
)
{
alog8
[
i
]
=
alog8
[
i
+
255
]
=
j
;
...
...
@@ -212,7 +214,7 @@ int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
j
^=
(
j
<<
1
)
^
(
j
<<
2
)
^
(
j
<<
3
)
^
(
j
<<
4
);
j
=
(
j
^
(
j
>>
8
)
^
99
)
&
255
;
inv_sbox
[
j
]
=
i
;
sbox
[
i
]
=
j
;
sbox
[
i
]
=
j
;
}
init_multbl2
(
dec_multbl
,
(
const
int
[
4
])
{
0xe
,
0x9
,
0xd
,
0xb
},
log8
,
alog8
,
inv_sbox
);
...
...
@@ -254,9 +256,8 @@ int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
a
->
round_key
[
i
]
=
tmp
[
0
];
}
}
else
{
for
(
i
=
0
;
i
<
(
rounds
+
1
)
>>
1
;
i
++
)
{
FFSWAP
(
av_aes_block
,
a
->
round_key
[
i
],
a
->
round_key
[
rounds
-
i
]);
}
for
(
i
=
0
;
i
<
(
rounds
+
1
)
>>
1
;
i
++
)
FFSWAP
(
av_aes_block
,
a
->
round_key
[
i
],
a
->
round_key
[
rounds
-
i
]);
}
return
0
;
...
...
@@ -264,6 +265,7 @@ int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
#ifdef TEST
#include <string.h>
#include "lfg.h"
#include "log.h"
...
...
@@ -276,12 +278,12 @@ int main(int argc, char **argv)
{
0x10
,
0xa5
,
0x88
,
0x69
,
0xd7
,
0x4b
,
0xe5
,
0xa3
,
0x74
,
0xcf
,
0x86
,
0x7c
,
0xfb
,
0x47
,
0x38
,
0x59
}
};
uint8_t
pt
[
16
],
rpt
[
2
][
16
]
=
{
uint8_t
pt
[
16
],
rpt
[
2
][
16
]
=
{
{
0x6a
,
0x84
,
0x86
,
0x7c
,
0xd7
,
0x7e
,
0x12
,
0xad
,
0x07
,
0xea
,
0x1b
,
0xe8
,
0x95
,
0xc5
,
0x3f
,
0xa3
},
{
0
}
};
uint8_t
rct
[
2
][
16
]
=
{
uint8_t
rct
[
2
][
16
]
=
{
{
0x73
,
0x22
,
0x81
,
0xc0
,
0xa0
,
0xaa
,
0xb8
,
0xf7
,
0xa5
,
0x4a
,
0x0c
,
0x67
,
0xa0
,
0xc4
,
0x5e
,
0xcf
},
{
0x6d
,
0x25
,
0x1e
,
0x69
,
0x44
,
0xb0
,
0x51
,
0xe0
,
...
...
@@ -313,9 +315,8 @@ int main(int argc, char **argv)
av_lfg_init
(
&
prng
,
1
);
for
(
i
=
0
;
i
<
10000
;
i
++
)
{
for
(
j
=
0
;
j
<
16
;
j
++
)
{
for
(
j
=
0
;
j
<
16
;
j
++
)
pt
[
j
]
=
av_lfg_get
(
&
prng
);
}
{
START_TIMER
;
av_aes_crypt
(
&
ae
,
temp
,
pt
,
1
,
NULL
,
0
);
...
...
libavutil/crc.c
View file @
3b08d9d9
...
...
@@ -19,8 +19,9 @@
*/
#include "config.h"
#include "common.h"
#include "bswap.h"
#include "common.h"
#include "crc.h"
#if CONFIG_HARDCODED_TABLES
...
...
@@ -287,7 +288,7 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)
if
(
ctx_size
>=
sizeof
(
AVCRC
)
*
1024
)
for
(
i
=
0
;
i
<
256
;
i
++
)
for
(
j
=
0
;
j
<
3
;
j
++
)
ctx
[
256
*
(
j
+
1
)
+
i
]
=
ctx
[
256
*
(
j
+
1
)
+
i
]
=
(
ctx
[
256
*
j
+
i
]
>>
8
)
^
ctx
[
ctx
[
256
*
j
+
i
]
&
0xFF
];
#endif
...
...
@@ -338,11 +339,12 @@ int main(void)
{
uint8_t
buf
[
1999
];
int
i
;
int
p
[
5
][
3
]
=
{
{
AV_CRC_32_IEEE_LE
,
0xEDB88320
,
0x3D5CDD04
},
{
AV_CRC_32_IEEE
,
0x04C11DB7
,
0xC0F5BAE0
},
{
AV_CRC_16_ANSI_LE
,
0xA001
,
0xBFD8
},
{
AV_CRC_16_ANSI
,
0x8005
,
0x1FBB
},
{
AV_CRC_8_ATM
,
0x07
,
0xE3
}
int
p
[
5
][
3
]
=
{
{
AV_CRC_32_IEEE_LE
,
0xEDB88320
,
0x3D5CDD04
},
{
AV_CRC_32_IEEE
,
0x04C11DB7
,
0xC0F5BAE0
},
{
AV_CRC_16_ANSI_LE
,
0xA001
,
0xBFD8
},
{
AV_CRC_16_ANSI
,
0x8005
,
0x1FBB
},
{
AV_CRC_8_ATM
,
0x07
,
0xE3
}
};
const
AVCRC
*
ctx
;
...
...
libavutil/des.c
View file @
3b08d9d9
This diff is collapsed.
Click to expand it.
libavutil/lls.c
View file @
3b08d9d9
...
...
@@ -141,7 +141,7 @@ int main(void)
LOCAL_ALIGNED
(
32
,
double
,
var
,
[
4
]);
double
eval
;
var
[
0
]
=
(
av_lfg_get
(
&
lfg
)
/
(
double
)
UINT_MAX
-
0
.
5
)
*
2
;
var
[
0
]
=
(
av_lfg_get
(
&
lfg
)
/
(
double
)
UINT_MAX
-
0
.
5
)
*
2
;
var
[
1
]
=
var
[
0
]
+
av_lfg_get
(
&
lfg
)
/
(
double
)
UINT_MAX
-
0
.
5
;
var
[
2
]
=
var
[
1
]
+
av_lfg_get
(
&
lfg
)
/
(
double
)
UINT_MAX
-
0
.
5
;
var
[
3
]
=
var
[
2
]
+
av_lfg_get
(
&
lfg
)
/
(
double
)
UINT_MAX
-
0
.
5
;
...
...
libavutil/md5.c
View file @
3b08d9d9
...
...
@@ -31,12 +31,13 @@
*/
#include <stdint.h>
#include "bswap.h"
#include "intreadwrite.h"
#include "md5.h"
#include "mem.h"
#include "md5.h"
typedef
struct
AVMD5
{
typedef
struct
AVMD5
{
uint64_t
len
;
uint8_t
block
[
64
];
uint32_t
ABCD
[
4
];
...
...
@@ -76,16 +77,21 @@ static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)
0xf7537e82
,
0xbd3af235
,
0x2ad7d2bb
,
0xeb86d391
,
};
#define CORE(i, a, b, c, d) do { \
t = S[i >> 4][i & 3]; \
#define CORE(i, a, b, c, d) \
do { \
t = S[i >> 4][i & 3]; \
a += T[i]; \
\
if (i < 32) { \
if (i < 16) a += (d ^ (b & (c ^ d))) + X[ i & 15]; \
else a += (c ^ (d & (c ^ b))) + X[(1 + 5*i) & 15]; \
if (i < 16) \
a += (d ^ (b & (c ^ d))) + X[i & 15]; \
else \
a += (c ^ (d & (c ^ b))) + X[(1 + 5 * i) & 15]; \
} else { \
if (i < 48) a += (b ^ c ^ d) + X[(5 + 3*i) & 15]; \
else a += (c ^ (b | ~d)) + X[( 7*i) & 15]; \
if (i < 48) \
a += (b ^ c ^ d) + X[(5 + 3 * i) & 15]; \
else \
a += (c ^ (b | ~d)) + X[(7 * i) & 15]; \
} \
a = b + (a << t | a >> (32 - t)); \
} while (0)
...
...
@@ -115,10 +121,13 @@ static void body(uint32_t ABCD[4], uint32_t X[16])
}
#else
#define CORE2(i) \
CORE( i, a,b,c,d); CORE((i+1),d,a,b,c); \
CORE((i+2),c,d,a,b); CORE((i+3),b,c,d,a)
#define CORE4(i) CORE2(i); CORE2((i+4)); CORE2((i+8)); CORE2((i+12))
CORE4
(
0
);
CORE4
(
16
);
CORE4
(
32
);
CORE4
(
48
);
CORE(i, a, b, c, d); CORE((i + 1), d, a, b, c); \
CORE((i + 2), c, d, a, b); CORE((i + 3), b, c, d, a)
#define CORE4(i) CORE2(i); CORE2((i + 4)); CORE2((i + 8)); CORE2((i + 12))
CORE4
(
0
);
CORE4
(
16
);
CORE4
(
32
);
CORE4
(
48
);
#endif
ABCD
[
0
]
+=
d
;
...
...
@@ -141,7 +150,7 @@ void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len)
{
int
i
,
j
;
j
=
ctx
->
len
&
63
;
j
=
ctx
->
len
&
63
;
ctx
->
len
+=
len
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
...
...
@@ -162,10 +171,10 @@ void av_md5_final(AVMD5 *ctx, uint8_t *dst)
while
((
ctx
->
len
&
63
)
!=
56
)
av_md5_update
(
ctx
,
""
,
1
);
av_md5_update
(
ctx
,
(
uint8_t
*
)
&
finalcount
,
8
);
av_md5_update
(
ctx
,
(
uint8_t
*
)
&
finalcount
,
8
);
for
(
i
=
0
;
i
<
4
;
i
++
)
AV_WL32
(
dst
+
4
*
i
,
ctx
->
ABCD
[
3
-
i
]);
AV_WL32
(
dst
+
4
*
i
,
ctx
->
ABCD
[
3
-
i
]);
}
void
av_md5_sum
(
uint8_t
*
dst
,
const
uint8_t
*
src
,
const
int
len
)
...
...
@@ -188,20 +197,26 @@ static void print_md5(uint8_t *md5)
printf
(
"
\n
"
);
}
int
main
(
void
){
int
main
(
void
)
{
uint8_t
md5val
[
16
];
int
i
;
uint8_t
in
[
1000
];
for
(
i
=
0
;
i
<
1000
;
i
++
)
in
[
i
]
=
i
*
i
;
av_md5_sum
(
md5val
,
in
,
1000
);
print_md5
(
md5val
);
av_md5_sum
(
md5val
,
in
,
63
);
print_md5
(
md5val
);
av_md5_sum
(
md5val
,
in
,
64
);
print_md5
(
md5val
);
av_md5_sum
(
md5val
,
in
,
65
);
print_md5
(
md5val
);
av_md5_sum
(
md5val
,
in
,
1000
);
print_md5
(
md5val
);
av_md5_sum
(
md5val
,
in
,
63
);
print_md5
(
md5val
);
av_md5_sum
(
md5val
,
in
,
64
);
print_md5
(
md5val
);
av_md5_sum
(
md5val
,
in
,
65
);
print_md5
(
md5val
);
for
(
i
=
0
;
i
<
1000
;
i
++
)
in
[
i
]
=
i
%
127
;
av_md5_sum
(
md5val
,
in
,
999
);
print_md5
(
md5val
);
av_md5_sum
(
md5val
,
in
,
999
);
print_md5
(
md5val
);
return
0
;
}
...
...
libavutil/opt.c
View file @
3b08d9d9
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment