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
a402f109
Commit
a402f109
authored
Jul 21, 2011
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple_idct: make repeated code a macro
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
7df701a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
144 deletions
+53
-144
simple_idct_template.c
libavcodec/simple_idct_template.c
+53
-144
No files found.
libavcodec/simple_idct_template.c
View file @
a402f109
...
...
@@ -161,60 +161,63 @@ static inline void FUNC(idctRowCondDC)(DCTELEM *row)
row
[
4
]
=
(
a3
-
b3
)
>>
ROW_SHIFT
;
}
#define IDCT_COLS do { \
a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); \
a1 = a0; \
a2 = a0; \
a3 = a0; \
\
a0 += W2*col[8*2]; \
a1 += W6*col[8*2]; \
a2 += -W6*col[8*2]; \
a3 += -W2*col[8*2]; \
\
b0 = MUL(W1, col[8*1]); \
b1 = MUL(W3, col[8*1]); \
b2 = MUL(W5, col[8*1]); \
b3 = MUL(W7, col[8*1]); \
\
MAC(b0, W3, col[8*3]); \
MAC(b1, -W7, col[8*3]); \
MAC(b2, -W1, col[8*3]); \
MAC(b3, -W5, col[8*3]); \
\
if (col[8*4]) { \
a0 += W4*col[8*4]; \
a1 += -W4*col[8*4]; \
a2 += -W4*col[8*4]; \
a3 += W4*col[8*4]; \
} \
\
if (col[8*5]) { \
MAC(b0, W5, col[8*5]); \
MAC(b1, -W1, col[8*5]); \
MAC(b2, W7, col[8*5]); \
MAC(b3, W3, col[8*5]); \
} \
\
if (col[8*6]) { \
a0 += W6*col[8*6]; \
a1 += -W2*col[8*6]; \
a2 += W2*col[8*6]; \
a3 += -W6*col[8*6]; \
} \
\
if (col[8*7]) { \
MAC(b0, W7, col[8*7]); \
MAC(b1, -W5, col[8*7]); \
MAC(b2, W3, col[8*7]); \
MAC(b3, -W1, col[8*7]); \
} \
} while (0)
static
inline
void
FUNC
(
idctSparseColPut
)(
pixel
*
dest
,
int
line_size
,
DCTELEM
*
col
)
{
int
a0
,
a1
,
a2
,
a3
,
b0
,
b1
,
b2
,
b3
;
INIT_CLIP
;
/* XXX: I did that only to give same values as previous code */
a0
=
W4
*
(
col
[
8
*
0
]
+
((
1
<<
(
COL_SHIFT
-
1
))
/
W4
));
a1
=
a0
;
a2
=
a0
;
a3
=
a0
;
a0
+=
+
W2
*
col
[
8
*
2
];
a1
+=
+
W6
*
col
[
8
*
2
];
a2
+=
-
W6
*
col
[
8
*
2
];
a3
+=
-
W2
*
col
[
8
*
2
];
b0
=
MUL
(
W1
,
col
[
8
*
1
]);
b1
=
MUL
(
W3
,
col
[
8
*
1
]);
b2
=
MUL
(
W5
,
col
[
8
*
1
]);
b3
=
MUL
(
W7
,
col
[
8
*
1
]);
MAC
(
b0
,
+
W3
,
col
[
8
*
3
]);
MAC
(
b1
,
-
W7
,
col
[
8
*
3
]);
MAC
(
b2
,
-
W1
,
col
[
8
*
3
]);
MAC
(
b3
,
-
W5
,
col
[
8
*
3
]);
if
(
col
[
8
*
4
]){
a0
+=
+
W4
*
col
[
8
*
4
];
a1
+=
-
W4
*
col
[
8
*
4
];
a2
+=
-
W4
*
col
[
8
*
4
];
a3
+=
+
W4
*
col
[
8
*
4
];
}
if
(
col
[
8
*
5
])
{
MAC
(
b0
,
+
W5
,
col
[
8
*
5
]);
MAC
(
b1
,
-
W1
,
col
[
8
*
5
]);
MAC
(
b2
,
+
W7
,
col
[
8
*
5
]);
MAC
(
b3
,
+
W3
,
col
[
8
*
5
]);
}
if
(
col
[
8
*
6
]){
a0
+=
+
W6
*
col
[
8
*
6
];
a1
+=
-
W2
*
col
[
8
*
6
];
a2
+=
+
W2
*
col
[
8
*
6
];
a3
+=
-
W6
*
col
[
8
*
6
];
}
if
(
col
[
8
*
7
])
{
MAC
(
b0
,
+
W7
,
col
[
8
*
7
]);
MAC
(
b1
,
-
W5
,
col
[
8
*
7
]);
MAC
(
b2
,
+
W3
,
col
[
8
*
7
]);
MAC
(
b3
,
-
W1
,
col
[
8
*
7
]);
}
IDCT_COLS
;
dest
[
0
]
=
CLIP
((
a0
+
b0
)
>>
COL_SHIFT
);
dest
+=
line_size
;
...
...
@@ -239,54 +242,7 @@ static inline void FUNC(idctSparseColAdd)(pixel *dest, int line_size,
int
a0
,
a1
,
a2
,
a3
,
b0
,
b1
,
b2
,
b3
;
INIT_CLIP
;
/* XXX: I did that only to give same values as previous code */
a0
=
W4
*
(
col
[
8
*
0
]
+
((
1
<<
(
COL_SHIFT
-
1
))
/
W4
));
a1
=
a0
;
a2
=
a0
;
a3
=
a0
;
a0
+=
+
W2
*
col
[
8
*
2
];
a1
+=
+
W6
*
col
[
8
*
2
];
a2
+=
-
W6
*
col
[
8
*
2
];
a3
+=
-
W2
*
col
[
8
*
2
];
b0
=
MUL
(
W1
,
col
[
8
*
1
]);
b1
=
MUL
(
W3
,
col
[
8
*
1
]);
b2
=
MUL
(
W5
,
col
[
8
*
1
]);
b3
=
MUL
(
W7
,
col
[
8
*
1
]);
MAC
(
b0
,
+
W3
,
col
[
8
*
3
]);
MAC
(
b1
,
-
W7
,
col
[
8
*
3
]);
MAC
(
b2
,
-
W1
,
col
[
8
*
3
]);
MAC
(
b3
,
-
W5
,
col
[
8
*
3
]);
if
(
col
[
8
*
4
]){
a0
+=
+
W4
*
col
[
8
*
4
];
a1
+=
-
W4
*
col
[
8
*
4
];
a2
+=
-
W4
*
col
[
8
*
4
];
a3
+=
+
W4
*
col
[
8
*
4
];
}
if
(
col
[
8
*
5
])
{
MAC
(
b0
,
+
W5
,
col
[
8
*
5
]);
MAC
(
b1
,
-
W1
,
col
[
8
*
5
]);
MAC
(
b2
,
+
W7
,
col
[
8
*
5
]);
MAC
(
b3
,
+
W3
,
col
[
8
*
5
]);
}
if
(
col
[
8
*
6
]){
a0
+=
+
W6
*
col
[
8
*
6
];
a1
+=
-
W2
*
col
[
8
*
6
];
a2
+=
+
W2
*
col
[
8
*
6
];
a3
+=
-
W6
*
col
[
8
*
6
];
}
if
(
col
[
8
*
7
])
{
MAC
(
b0
,
+
W7
,
col
[
8
*
7
]);
MAC
(
b1
,
-
W5
,
col
[
8
*
7
]);
MAC
(
b2
,
+
W3
,
col
[
8
*
7
]);
MAC
(
b3
,
-
W1
,
col
[
8
*
7
]);
}
IDCT_COLS
;
dest
[
0
]
=
CLIP
(
dest
[
0
]
+
((
a0
+
b0
)
>>
COL_SHIFT
));
dest
+=
line_size
;
...
...
@@ -309,54 +265,7 @@ static inline void FUNC(idctSparseCol)(DCTELEM *col)
{
int
a0
,
a1
,
a2
,
a3
,
b0
,
b1
,
b2
,
b3
;
/* XXX: I did that only to give same values as previous code */
a0
=
W4
*
(
col
[
8
*
0
]
+
((
1
<<
(
COL_SHIFT
-
1
))
/
W4
));
a1
=
a0
;
a2
=
a0
;
a3
=
a0
;
a0
+=
+
W2
*
col
[
8
*
2
];
a1
+=
+
W6
*
col
[
8
*
2
];
a2
+=
-
W6
*
col
[
8
*
2
];
a3
+=
-
W2
*
col
[
8
*
2
];
b0
=
MUL
(
W1
,
col
[
8
*
1
]);
b1
=
MUL
(
W3
,
col
[
8
*
1
]);
b2
=
MUL
(
W5
,
col
[
8
*
1
]);
b3
=
MUL
(
W7
,
col
[
8
*
1
]);
MAC
(
b0
,
+
W3
,
col
[
8
*
3
]);
MAC
(
b1
,
-
W7
,
col
[
8
*
3
]);
MAC
(
b2
,
-
W1
,
col
[
8
*
3
]);
MAC
(
b3
,
-
W5
,
col
[
8
*
3
]);
if
(
col
[
8
*
4
]){
a0
+=
+
W4
*
col
[
8
*
4
];
a1
+=
-
W4
*
col
[
8
*
4
];
a2
+=
-
W4
*
col
[
8
*
4
];
a3
+=
+
W4
*
col
[
8
*
4
];
}
if
(
col
[
8
*
5
])
{
MAC
(
b0
,
+
W5
,
col
[
8
*
5
]);
MAC
(
b1
,
-
W1
,
col
[
8
*
5
]);
MAC
(
b2
,
+
W7
,
col
[
8
*
5
]);
MAC
(
b3
,
+
W3
,
col
[
8
*
5
]);
}
if
(
col
[
8
*
6
]){
a0
+=
+
W6
*
col
[
8
*
6
];
a1
+=
-
W2
*
col
[
8
*
6
];
a2
+=
+
W2
*
col
[
8
*
6
];
a3
+=
-
W6
*
col
[
8
*
6
];
}
if
(
col
[
8
*
7
])
{
MAC
(
b0
,
+
W7
,
col
[
8
*
7
]);
MAC
(
b1
,
-
W5
,
col
[
8
*
7
]);
MAC
(
b2
,
+
W3
,
col
[
8
*
7
]);
MAC
(
b3
,
-
W1
,
col
[
8
*
7
]);
}
IDCT_COLS
;
col
[
0
]
=
((
a0
+
b0
)
>>
COL_SHIFT
);
col
[
8
]
=
((
a1
+
b1
)
>>
COL_SHIFT
);
...
...
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