Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
d3fe3b2a
Commit
d3fe3b2a
authored
Nov 19, 2015
by
Alex Converse
Browse files
Avoid an unsigned overflow in invert_quant
Change-Id: I16a570b2af66b6580d1cd6f8345a25f079009bf4
parent
b2ccb9c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
vp10/encoder/quantize.c
View file @
d3fe3b2a
...
...
@@ -219,12 +219,12 @@ void vp10_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
static
void
invert_quant
(
int16_t
*
quant
,
int16_t
*
shift
,
int
d
)
{
unsigned
t
;
int
l
;
int
l
,
m
;
t
=
d
;
for
(
l
=
0
;
t
>
1
;
l
++
)
t
>>=
1
;
t
=
1
+
(
1
<<
(
16
+
l
))
/
d
;
*
quant
=
(
int16_t
)(
t
-
(
1
<<
16
));
m
=
1
+
(
1
<<
(
16
+
l
))
/
d
;
*
quant
=
(
int16_t
)(
m
-
(
1
<<
16
));
*
shift
=
1
<<
(
16
-
l
);
}
...
...
vp8/encoder/vp8_quantize.c
View file @
d3fe3b2a
...
...
@@ -227,12 +227,12 @@ static void invert_quant(int improved_quant, short *quant,
if
(
improved_quant
)
{
unsigned
t
;
int
l
;
int
l
,
m
;
t
=
d
;
for
(
l
=
0
;
t
>
1
;
l
++
)
t
>>=
1
;
t
=
1
+
(
1
<<
(
16
+
l
))
/
d
;
*
quant
=
(
short
)(
t
-
(
1
<<
16
));
m
=
1
+
(
1
<<
(
16
+
l
))
/
d
;
*
quant
=
(
short
)(
m
-
(
1
<<
16
));
*
shift
=
l
;
/* use multiplication and constant shift by 16 */
*
shift
=
1
<<
(
16
-
*
shift
);
...
...
vp9/encoder/vp9_quantize.c
View file @
d3fe3b2a
...
...
@@ -219,12 +219,12 @@ void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
static
void
invert_quant
(
int16_t
*
quant
,
int16_t
*
shift
,
int
d
)
{
unsigned
t
;
int
l
;
int
l
,
m
;
t
=
d
;
for
(
l
=
0
;
t
>
1
;
l
++
)
t
>>=
1
;
t
=
1
+
(
1
<<
(
16
+
l
))
/
d
;
*
quant
=
(
int16_t
)(
t
-
(
1
<<
16
));
m
=
1
+
(
1
<<
(
16
+
l
))
/
d
;
*
quant
=
(
int16_t
)(
m
-
(
1
<<
16
));
*
shift
=
1
<<
(
16
-
l
);
}
...
...
Write
Preview
Supports
Markdown
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