Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
dc0e1126
Commit
dc0e1126
authored
Sep 22, 2017
by
Jonathan Matthews
Browse files
palette_delta_encoding: clamp y and u colors
BUG=aomedia:812 Change-Id: I635d620fc6d350391ecb7885cc119eaef0af39bc
parent
15f6b863
Changes
1
Hide whitespace changes
Inline
Side-by-side
av1/decoder/decodemv.c
View file @
dc0e1126
...
...
@@ -716,9 +716,11 @@ static void read_palette_colors_y(MACROBLOCKD *const xd, int bit_depth,
int
bits
=
min_bits
+
aom_read_literal
(
r
,
2
,
ACCT_STR
);
int
range
=
(
1
<<
bit_depth
)
-
pmi
->
palette_colors
[
idx
-
1
]
-
1
;
for
(;
idx
<
n
;
++
idx
)
{
assert
(
range
>=
0
);
const
int
delta
=
aom_read_literal
(
r
,
bits
,
ACCT_STR
)
+
1
;
pmi
->
palette_colors
[
idx
]
=
pmi
->
palette_colors
[
idx
-
1
]
+
delta
;
range
-=
delta
;
pmi
->
palette_colors
[
idx
]
=
clamp
(
pmi
->
palette_colors
[
idx
-
1
]
+
delta
,
0
,
(
1
<<
bit_depth
)
-
1
);
range
-=
(
pmi
->
palette_colors
[
idx
]
-
pmi
->
palette_colors
[
idx
-
1
]);
bits
=
AOMMIN
(
bits
,
av1_ceil_log2
(
range
));
}
}
...
...
@@ -743,9 +745,11 @@ static void read_palette_colors_uv(MACROBLOCKD *const xd, int bit_depth,
int
bits
=
min_bits
+
aom_read_literal
(
r
,
2
,
ACCT_STR
);
int
range
=
(
1
<<
bit_depth
)
-
pmi
->
palette_colors
[
idx
-
1
];
for
(;
idx
<
PALETTE_MAX_SIZE
+
n
;
++
idx
)
{
assert
(
range
>=
0
);
const
int
delta
=
aom_read_literal
(
r
,
bits
,
ACCT_STR
);
pmi
->
palette_colors
[
idx
]
=
pmi
->
palette_colors
[
idx
-
1
]
+
delta
;
range
-=
delta
;
pmi
->
palette_colors
[
idx
]
=
clamp
(
pmi
->
palette_colors
[
idx
-
1
]
+
delta
,
0
,
(
1
<<
bit_depth
)
-
1
);
range
-=
(
pmi
->
palette_colors
[
idx
]
-
pmi
->
palette_colors
[
idx
-
1
]);
bits
=
AOMMIN
(
bits
,
av1_ceil_log2
(
range
));
}
}
...
...
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