Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
88c1c3f4
Commit
88c1c3f4
authored
Nov 30, 2017
by
Sebastien Alaiwan
Committed by
Frédéric BARBIER
Nov 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pred_common.c: extract func 'palette_add_to_cache'
Change-Id: Ie6f6f5405cfe4c59dec1dc6dabc9ef5bcf2fb756
parent
09191ca2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
av1/common/pred_common.c
av1/common/pred_common.c
+11
-4
No files found.
av1/common/pred_common.c
View file @
88c1c3f4
...
...
@@ -101,6 +101,13 @@ int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
#endif
#if CONFIG_PALETTE_DELTA_ENCODING
static
void
palette_add_to_cache
(
uint16_t
*
cache
,
int
*
n
,
uint16_t
val
)
{
// Do not add an already existing value
if
(
*
n
>
0
&&
val
==
cache
[
*
n
-
1
])
return
;
cache
[(
*
n
)
++
]
=
val
;
}
int
av1_get_palette_cache
(
const
MACROBLOCKD
*
const
xd
,
int
plane
,
uint16_t
*
cache
)
{
const
int
row
=
-
xd
->
mb_to_top_edge
>>
3
;
...
...
@@ -127,21 +134,21 @@ int av1_get_palette_cache(const MACROBLOCKD *const xd, int plane,
uint16_t
v_above
=
above_colors
[
above_idx
];
uint16_t
v_left
=
left_colors
[
left_idx
];
if
(
v_left
<
v_above
)
{
if
(
n
==
0
||
v_left
!=
cache
[
n
-
1
])
cache
[
n
++
]
=
v_left
;
palette_add_to_cache
(
cache
,
&
n
,
v_left
)
;
++
left_idx
,
--
left_n
;
}
else
{
if
(
n
==
0
||
v_above
!=
cache
[
n
-
1
])
cache
[
n
++
]
=
v_above
;
palette_add_to_cache
(
cache
,
&
n
,
v_above
)
;
++
above_idx
,
--
above_n
;
if
(
v_left
==
v_above
)
++
left_idx
,
--
left_n
;
}
}
while
(
above_n
--
>
0
)
{
uint16_t
val
=
above_colors
[
above_idx
++
];
if
(
n
==
0
||
val
!=
cache
[
n
-
1
])
cache
[
n
++
]
=
val
;
palette_add_to_cache
(
cache
,
&
n
,
val
)
;
}
while
(
left_n
--
>
0
)
{
uint16_t
val
=
left_colors
[
left_idx
++
];
if
(
n
==
0
||
val
!=
cache
[
n
-
1
])
cache
[
n
++
]
=
val
;
palette_add_to_cache
(
cache
,
&
n
,
val
)
;
}
assert
(
n
<=
2
*
PALETTE_MAX_SIZE
);
return
n
;
...
...
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