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
6ebd06a9
Commit
6ebd06a9
authored
Mar 24, 2016
by
Diego Biurrun
Committed by
Vittorio Giovara
Mar 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
intrax8: Drop lots of pointless parentheses
Signed-off-by:
Vittorio Giovara
<
vittorio.giovara@gmail.com
>
parent
9b57995c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
40 deletions
+40
-40
intrax8.c
libavcodec/intrax8.c
+35
-35
intrax8dsp.c
libavcodec/intrax8dsp.c
+5
-5
No files found.
libavcodec/intrax8.c
View file @
6ebd06a9
...
@@ -217,9 +217,9 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
...
@@ -217,9 +217,9 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
if
(
i
<
46
)
{
// [0-45]
if
(
i
<
46
)
{
// [0-45]
int
t
,
l
;
int
t
,
l
;
if
(
i
<
0
)
{
if
(
i
<
0
)
{
(
*
level
)
=
*
level
=
(
*
final
)
=
// prevent 'may be used unilitialized'
*
final
=
// prevent 'may be used unilitialized'
(
*
run
)
=
64
;
// this would cause error exit in the ac loop
*
run
=
64
;
// this would cause error exit in the ac loop
return
;
return
;
}
}
...
@@ -230,20 +230,20 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
...
@@ -230,20 +230,20 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
* i == 22 r = 0 l = 3; r = i & %00000
* i == 22 r = 0 l = 3; r = i & %00000
*/
*/
(
*
final
)
=
*
final
=
t
=
(
i
>
22
)
;
t
=
i
>
22
;
i
-=
23
*
t
;
i
-=
23
*
t
;
/* l = lut_l[i / 2] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3 }[i >> 1];
/* l = lut_l[i / 2] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3 }[i >> 1];
* 11 10'01 01'00 00'00 00'00 00'00 00 => 0xE50000 */
* 11 10'01 01'00 00'00 00'00 00'00 00 => 0xE50000 */
l
=
(
0xE50000
>>
(
i
&
(
0x1E
)))
&
3
;
// 0x1E or (~1) or ((i >> 1)
<< 1)
l
=
(
0xE50000
>>
(
i
&
0x1E
))
&
3
;
// 0x1E or ~1 or (i >> 1
<< 1)
/* t = lut_mask[l] = { 0x0f, 0x03, 0x01, 0x00 }[l];
/* t = lut_mask[l] = { 0x0f, 0x03, 0x01, 0x00 }[l];
* as i < 256 the higher bits do not matter */
* as i < 256 the higher bits do not matter */
t
=
(
0x01030F
>>
(
l
<<
3
)
);
t
=
0x01030F
>>
(
l
<<
3
);
(
*
run
)
=
i
&
t
;
*
run
=
i
&
t
;
(
*
level
)
=
l
;
*
level
=
l
;
}
else
if
(
i
<
73
)
{
// [46-72]
}
else
if
(
i
<
73
)
{
// [46-72]
uint32_t
sm
;
uint32_t
sm
;
uint32_t
mask
;
uint32_t
mask
;
...
@@ -256,9 +256,9 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
...
@@ -256,9 +256,9 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
mask
=
sm
&
0xff
;
mask
=
sm
&
0xff
;
sm
>>=
8
;
// 1bit
sm
>>=
8
;
// 1bit
(
*
run
)
=
(
sm
&
0xff
)
+
(
e
&
(
mask
));
// 6bits
*
run
=
(
sm
&
0xff
)
+
(
e
&
mask
);
// 6bits
(
*
level
)
=
(
sm
>>
8
)
+
(
e
&
(
~
mask
));
// 5bits
*
level
=
(
sm
>>
8
)
+
(
e
&
~
mask
);
// 5bits
(
*
final
)
=
i
>
(
58
-
46
);
*
final
=
i
>
(
58
-
46
);
}
else
if
(
i
<
75
)
{
// [73-74]
}
else
if
(
i
<
75
)
{
// [73-74]
static
const
uint8_t
crazy_mix_runlevel
[
32
]
=
{
static
const
uint8_t
crazy_mix_runlevel
[
32
]
=
{
0x22
,
0x32
,
0x33
,
0x53
,
0x23
,
0x42
,
0x43
,
0x63
,
0x22
,
0x32
,
0x33
,
0x53
,
0x23
,
0x42
,
0x43
,
0x63
,
...
@@ -267,14 +267,14 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
...
@@ -267,14 +267,14 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
0x28
,
0x92
,
0x36
,
0x74
,
0x29
,
0xa2
,
0x46
,
0x84
,
0x28
,
0x92
,
0x36
,
0x74
,
0x29
,
0xa2
,
0x46
,
0x84
,
};
};
(
*
final
)
=
!
(
i
&
1
);
*
final
=
!
(
i
&
1
);
e
=
get_bits
(
w
->
gb
,
5
);
// get the extra bits
e
=
get_bits
(
w
->
gb
,
5
);
// get the extra bits
(
*
run
)
=
crazy_mix_runlevel
[
e
]
>>
4
;
*
run
=
crazy_mix_runlevel
[
e
]
>>
4
;
(
*
level
)
=
crazy_mix_runlevel
[
e
]
&
0x0F
;
*
level
=
crazy_mix_runlevel
[
e
]
&
0x0F
;
}
else
{
}
else
{
(
*
level
)
=
get_bits
(
w
->
gb
,
7
-
3
*
(
i
&
1
));
*
level
=
get_bits
(
w
->
gb
,
7
-
3
*
(
i
&
1
));
(
*
run
)
=
get_bits
(
w
->
gb
,
6
);
*
run
=
get_bits
(
w
->
gb
,
6
);
(
*
final
)
=
get_bits1
(
w
->
gb
);
*
final
=
get_bits1
(
w
->
gb
);
}
}
return
;
return
;
}
}
...
@@ -303,12 +303,12 @@ static int x8_get_dc_rlf(IntraX8Context *const w, const int mode,
...
@@ -303,12 +303,12 @@ static int x8_get_dc_rlf(IntraX8Context *const w, const int mode,
i
=
get_vlc2
(
w
->
gb
,
w
->
j_dc_vlc
[
mode
]
->
table
,
DC_VLC_BITS
,
DC_VLC_MTD
);
i
=
get_vlc2
(
w
->
gb
,
w
->
j_dc_vlc
[
mode
]
->
table
,
DC_VLC_BITS
,
DC_VLC_MTD
);
/* (i >= 17) { i -= 17; final =1; } */
/* (i >= 17) { i -= 17; final =1; } */
c
=
i
>
16
;
c
=
i
>
16
;
(
*
final
)
=
c
;
*
final
=
c
;
i
-=
17
*
c
;
i
-=
17
*
c
;
if
(
i
<=
0
)
{
if
(
i
<=
0
)
{
(
*
level
)
=
0
;
*
level
=
0
;
return
-
i
;
return
-
i
;
}
}
c
=
(
i
+
1
)
>>
1
;
// hackish way to calculate dc_extra_sbits[]
c
=
(
i
+
1
)
>>
1
;
// hackish way to calculate dc_extra_sbits[]
...
@@ -317,8 +317,8 @@ static int x8_get_dc_rlf(IntraX8Context *const w, const int mode,
...
@@ -317,8 +317,8 @@ static int x8_get_dc_rlf(IntraX8Context *const w, const int mode,
e
=
get_bits
(
w
->
gb
,
c
);
// get the extra bits
e
=
get_bits
(
w
->
gb
,
c
);
// get the extra bits
i
=
dc_index_offset
[
i
]
+
(
e
>>
1
);
i
=
dc_index_offset
[
i
]
+
(
e
>>
1
);
e
=
-
(
e
&
1
);
// 0, 0xffffff
e
=
-
(
e
&
1
);
// 0, 0xffffff
(
*
level
)
=
(
i
^
e
)
-
e
;
// (i ^ 0) -0
, (i ^ 0xff) - (-1)
*
level
=
(
i
^
e
)
-
e
;
// (i ^ 0) - 0
, (i ^ 0xff) - (-1)
return
0
;
return
0
;
}
}
...
@@ -349,7 +349,7 @@ static int x8_setup_spatial_predictor(IntraX8Context *const w, const int chroma)
...
@@ -349,7 +349,7 @@ static int x8_setup_spatial_predictor(IntraX8Context *const w, const int chroma)
w
->
flat_dc
=
1
;
w
->
flat_dc
=
1
;
sum
+=
9
;
sum
+=
9
;
// ((1 << 17) + 9) / (8 + 8 + 1 + 2) = 6899
// ((1 << 17) + 9) / (8 + 8 + 1 + 2) = 6899
w
->
predicted_dc
=
(
sum
*
6899
)
>>
17
;
w
->
predicted_dc
=
sum
*
6899
>>
17
;
}
}
}
}
if
(
chroma
)
if
(
chroma
)
...
@@ -394,8 +394,8 @@ static void x8_update_predictions(IntraX8Context *const w, const int orient,
...
@@ -394,8 +394,8 @@ static void x8_update_predictions(IntraX8Context *const w, const int orient,
static
void
x8_get_prediction_chroma
(
IntraX8Context
*
const
w
)
static
void
x8_get_prediction_chroma
(
IntraX8Context
*
const
w
)
{
{
w
->
edges
=
1
*
(
!
(
w
->
mb_x
>>
1
)
);
w
->
edges
=
1
*
!
(
w
->
mb_x
>>
1
);
w
->
edges
|=
2
*
(
!
(
w
->
mb_y
>>
1
)
);
w
->
edges
|=
2
*
!
(
w
->
mb_y
>>
1
);
w
->
edges
|=
4
*
(
w
->
mb_x
>=
(
2
*
w
->
mb_width
-
1
));
// mb_x for chroma would always be odd
w
->
edges
|=
4
*
(
w
->
mb_x
>=
(
2
*
w
->
mb_width
-
1
));
// mb_x for chroma would always be odd
w
->
raw_orient
=
0
;
w
->
raw_orient
=
0
;
...
@@ -412,8 +412,8 @@ static void x8_get_prediction(IntraX8Context *const w)
...
@@ -412,8 +412,8 @@ static void x8_get_prediction(IntraX8Context *const w)
{
{
int
a
,
b
,
c
,
i
;
int
a
,
b
,
c
,
i
;
w
->
edges
=
1
*
(
!
w
->
mb_x
)
;
w
->
edges
=
1
*
!
w
->
mb_x
;
w
->
edges
|=
2
*
(
!
w
->
mb_y
)
;
w
->
edges
|=
2
*
!
w
->
mb_y
;
w
->
edges
|=
4
*
(
w
->
mb_x
>=
(
2
*
w
->
mb_width
-
1
));
w
->
edges
|=
4
*
(
w
->
mb_x
>=
(
2
*
w
->
mb_width
-
1
));
switch
(
w
->
edges
&
3
)
{
switch
(
w
->
edges
&
3
)
{
...
@@ -663,7 +663,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
...
@@ -663,7 +663,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
goto
block_placed
;
goto
block_placed
;
}
}
zeros_only
=
(
dc_level
==
0
)
;
zeros_only
=
dc_level
==
0
;
}
}
if
(
!
chroma
)
if
(
!
chroma
)
w
->
block
[
0
][
0
]
=
dc_level
*
w
->
quant
;
w
->
block
[
0
][
0
]
=
dc_level
*
w
->
quant
;
...
@@ -724,10 +724,10 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame)
...
@@ -724,10 +724,10 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame)
w
->
dest
[
1
]
=
frame
->
data
[
1
];
w
->
dest
[
1
]
=
frame
->
data
[
1
];
w
->
dest
[
2
]
=
frame
->
data
[
2
];
w
->
dest
[
2
]
=
frame
->
data
[
2
];
w
->
dest
[
0
]
+=
w
->
mb_y
*
linesize
<<
3
;
w
->
dest
[
0
]
+=
w
->
mb_y
*
linesize
<<
3
;
// chroma blocks are on add rows
// chroma blocks are on add rows
w
->
dest
[
1
]
+=
(
w
->
mb_y
&
(
~
1
)
)
*
uvlinesize
<<
2
;
w
->
dest
[
1
]
+=
(
w
->
mb_y
&
~
1
)
*
uvlinesize
<<
2
;
w
->
dest
[
2
]
+=
(
w
->
mb_y
&
(
~
1
)
)
*
uvlinesize
<<
2
;
w
->
dest
[
2
]
+=
(
w
->
mb_y
&
~
1
)
*
uvlinesize
<<
2
;
}
}
av_cold
int
ff_intrax8_common_init
(
AVCodecContext
*
avctx
,
av_cold
int
ff_intrax8_common_init
(
AVCodecContext
*
avctx
,
...
...
libavcodec/intrax8dsp.c
View file @
6ebd06a9
...
@@ -91,7 +91,7 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
...
@@ -91,7 +91,7 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
for
(
i
=
7
;
i
>=
0
;
i
--
)
{
for
(
i
=
7
;
i
>=
0
;
i
--
)
{
c
=
*
(
ptr
-
1
);
// area1, same mb as area2, no need to check
c
=
*
(
ptr
-
1
);
// area1, same mb as area2, no need to check
dst
[
area1
+
i
]
=
c
;
dst
[
area1
+
i
]
=
c
;
c
=
*
(
ptr
)
;
c
=
*
ptr
;
sum
+=
c
;
sum
+=
c
;
min_pix
=
FFMIN
(
min_pix
,
c
);
min_pix
=
FFMIN
(
min_pix
,
c
);
...
@@ -136,9 +136,9 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
...
@@ -136,9 +136,9 @@ static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst,
sum
+=
c
;
sum
+=
c
;
// edge pixel is not part of min/max
// edge pixel is not part of min/max
}
}
(
*
range
)
=
max_pix
-
min_pix
;
*
range
=
max_pix
-
min_pix
;
sum
+=
*
(
dst
+
area5
)
+
*
(
dst
+
area5
+
1
);
sum
+=
*
(
dst
+
area5
)
+
*
(
dst
+
area5
+
1
);
*
psum
=
sum
;
*
psum
=
sum
;
}
}
static
const
uint16_t
zero_prediction_weights
[
64
*
2
]
=
{
static
const
uint16_t
zero_prediction_weights
[
64
*
2
]
=
{
...
@@ -419,7 +419,7 @@ static void x8_loop_filter(uint8_t *ptr, const int a_stride, const int b_stride,
...
@@ -419,7 +419,7 @@ static void x8_loop_filter(uint8_t *ptr, const int a_stride, const int b_stride,
m
=
(
m
^
sign
)
-
sign
;
// abs(m)
m
=
(
m
^
sign
)
-
sign
;
// abs(m)
m
>>=
1
;
m
>>=
1
;
x
=
(
5
*
x
)
>>
3
;
x
=
5
*
x
>>
3
;
if
(
x
>
m
)
if
(
x
>
m
)
x
=
m
;
x
=
m
;
...
...
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