Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ee4c01be
Commit
ee4c01be
authored
Apr 26, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vc1dec: factor lut clean code
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
ba323d67
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
25 deletions
+23
-25
vc1.c
libavcodec/vc1.c
+23
-25
No files found.
libavcodec/vc1.c
View file @
ee4c01be
...
...
@@ -576,25 +576,6 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContex
return
0
;
}
static
void
rotate_luts
(
VC1Context
*
v
)
{
#define ROTATE(DEF, L, N, C, A) do {\
if (v->s.pict_type == AV_PICTURE_TYPE_BI || v->s.pict_type == AV_PICTURE_TYPE_B) {\
C = A;\
} else {\
DEF;\
memcpy(&tmp, &L , sizeof(tmp));\
memcpy(&L , &N , sizeof(tmp));\
memcpy(&N , &tmp, sizeof(tmp));\
C = N;\
}\
}while(0)
ROTATE
(
int
tmp
,
v
->
last_use_ic
,
v
->
next_use_ic
,
v
->
curr_use_ic
,
v
->
aux_use_ic
);
ROTATE
(
uint8_t
tmp
[
2
][
256
],
v
->
last_luty
,
v
->
next_luty
,
v
->
curr_luty
,
v
->
aux_luty
);
ROTATE
(
uint8_t
tmp
[
2
][
256
],
v
->
last_lutuv
,
v
->
next_lutuv
,
v
->
curr_lutuv
,
v
->
aux_lutuv
);
}
/* fill lookup tables for intensity compensation */
#define INIT_LUT(lumscale, lumshift, luty, lutuv, chain) do {\
int scale, shift, i; \
...
...
@@ -619,6 +600,29 @@ static void rotate_luts(VC1Context *v)
}while(0)
static
void
rotate_luts
(
VC1Context
*
v
)
{
#define ROTATE(DEF, L, N, C, A) do {\
if (v->s.pict_type == AV_PICTURE_TYPE_BI || v->s.pict_type == AV_PICTURE_TYPE_B) {\
C = A;\
} else {\
DEF;\
memcpy(&tmp, &L , sizeof(tmp));\
memcpy(&L , &N , sizeof(tmp));\
memcpy(&N , &tmp, sizeof(tmp));\
C = N;\
}\
}while(0)
ROTATE
(
int
tmp
,
v
->
last_use_ic
,
v
->
next_use_ic
,
v
->
curr_use_ic
,
v
->
aux_use_ic
);
ROTATE
(
uint8_t
tmp
[
2
][
256
],
v
->
last_luty
,
v
->
next_luty
,
v
->
curr_luty
,
v
->
aux_luty
);
ROTATE
(
uint8_t
tmp
[
2
][
256
],
v
->
last_lutuv
,
v
->
next_lutuv
,
v
->
curr_lutuv
,
v
->
aux_lutuv
);
INIT_LUT
(
32
,
0
,
v
->
curr_luty
[
0
]
,
v
->
curr_lutuv
[
0
]
,
0
);
INIT_LUT
(
32
,
0
,
v
->
curr_luty
[
1
]
,
v
->
curr_lutuv
[
1
]
,
0
);
v
->
curr_use_ic
=
0
;
}
int
ff_vc1_parse_frame_header
(
VC1Context
*
v
,
GetBitContext
*
gb
)
{
int
pqindex
,
lowquant
,
status
;
...
...
@@ -709,9 +713,6 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
if
(
v
->
first_pic_header_flag
)
{
rotate_luts
(
v
);
INIT_LUT
(
32
,
0
,
v
->
curr_luty
[
0
]
,
v
->
curr_lutuv
[
0
]
,
0
);
INIT_LUT
(
32
,
0
,
v
->
curr_luty
[
1
]
,
v
->
curr_lutuv
[
1
]
,
0
);
v
->
curr_use_ic
=
0
;
}
switch
(
v
->
s
.
pict_type
)
{
...
...
@@ -986,9 +987,6 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
if
(
v
->
first_pic_header_flag
)
{
rotate_luts
(
v
);
INIT_LUT
(
32
,
0
,
v
->
curr_luty
[
0
]
,
v
->
curr_lutuv
[
0
]
,
0
);
INIT_LUT
(
32
,
0
,
v
->
curr_luty
[
1
]
,
v
->
curr_lutuv
[
1
]
,
0
);
v
->
curr_use_ic
=
0
;
}
switch
(
v
->
s
.
pict_type
)
{
...
...
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