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
8011ac91
Commit
8011ac91
authored
Jan 10, 2014
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hpeldsp_template: Detemplatize the code
The indirection makes no sense without multiple instantiation.
parent
2c01ad8b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
112 deletions
+104
-112
hpeldsp.c
libavcodec/hpeldsp.c
+2
-0
hpeldsp_template.c
libavcodec/hpeldsp_template.c
+102
-112
No files found.
libavcodec/hpeldsp.c
View file @
8011ac91
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
#include "hpeldsp.h"
#include "hpeldsp.h"
#define BIT_DEPTH 8
#define BIT_DEPTH 8
#include "hpel_template.c"
#include "tpel_template.c"
#include "hpeldsp_template.c"
#include "hpeldsp_template.c"
av_cold
void
ff_hpeldsp_init
(
HpelDSPContext
*
c
,
int
flags
)
av_cold
void
ff_hpeldsp_init
(
HpelDSPContext
*
c
,
int
flags
)
...
...
libavcodec/hpeldsp_template.c
View file @
8011ac91
...
@@ -30,13 +30,8 @@
...
@@ -30,13 +30,8 @@
#include "pixels.h"
#include "pixels.h"
#include "bit_depth_template.c"
#include "hpel_template.c"
#include "tpel_template.c"
#define PIXOP2(OPNAME, OP) \
#define PIXOP2(OPNAME, OP) \
static inline void
FUNC(OPNAME ## _no_rnd_pixels8_l2)(uint8_t *dst,
\
static inline void
OPNAME ## _no_rnd_pixels8_l2_8(uint8_t *dst,
\
const uint8_t *src1, \
const uint8_t *src1, \
const uint8_t *src2, \
const uint8_t *src2, \
int dst_stride, \
int dst_stride, \
...
@@ -47,104 +42,101 @@ static inline void FUNC(OPNAME ## _no_rnd_pixels8_l2)(uint8_t *dst, \
...
@@ -47,104 +42,101 @@ static inline void FUNC(OPNAME ## _no_rnd_pixels8_l2)(uint8_t *dst, \
int i; \
int i; \
\
\
for (i = 0; i < h; i++) { \
for (i = 0; i < h; i++) { \
pixel4 a, b;
\
uint32_t a, b;
\
a = AV_RN
4P
(&src1[i * src_stride1]); \
a = AV_RN
32
(&src1[i * src_stride1]); \
b = AV_RN
4P
(&src2[i * src_stride2]); \
b = AV_RN
32
(&src2[i * src_stride2]); \
OP(*((
pixel4 *) &dst[i * dst_stride]),
\
OP(*((
uint32_t *) &dst[i * dst_stride]),
\
no_rnd_avg
_pixel4(a, b));
\
no_rnd_avg
32(a, b));
\
a = AV_RN
4P(&src1[i * src_stride1 + 4 * sizeof(pixel)]);
\
a = AV_RN
32(&src1[i * src_stride1 + 4]);
\
b = AV_RN
4P(&src2[i * src_stride2 + 4 * sizeof(pixel)]);
\
b = AV_RN
32(&src2[i * src_stride2 + 4]);
\
OP(*((
pixel4 *) &dst[i * dst_stride + 4 * sizeof(pixel)]),
\
OP(*((
uint32_t *) &dst[i * dst_stride + 4]),
\
no_rnd_avg
_pixel4(a, b));
\
no_rnd_avg
32(a, b));
\
} \
} \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _no_rnd_pixels8_x2)(uint8_t *block,
\
static inline void
OPNAME ## _no_rnd_pixels8_x2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
FUNC(OPNAME ## _no_rnd_pixels8_l2)(block, pixels, pixels + sizeof(pixel),
\
OPNAME ## _no_rnd_pixels8_l2_8(block, pixels, pixels + 1,
\
line_size, line_size, line_size, h); \
line_size, line_size, line_size, h); \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels8_x2)(uint8_t *block,
\
static inline void
OPNAME ## _pixels8_x2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
FUNC(OPNAME ## _pixels8_l2)(block, pixels, pixels + sizeof(pixel),
\
OPNAME ## _pixels8_l2_8(block, pixels, pixels + 1,
\
line_size, line_size, line_size, h); \
line_size, line_size, line_size, h); \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _no_rnd_pixels8_y2)(uint8_t *block,
\
static inline void
OPNAME ## _no_rnd_pixels8_y2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
FUNC(OPNAME ## _no_rnd_pixels8_l2)(block, pixels, pixels + line_size,
\
OPNAME ## _no_rnd_pixels8_l2_8(block, pixels, pixels + line_size,
\
line_size, line_size, line_size, h); \
line_size, line_size, line_size, h); \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels8_y2)(uint8_t *block,
\
static inline void
OPNAME ## _pixels8_y2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
FUNC(OPNAME ## _pixels8_l2)(block, pixels, pixels + line_size,
\
OPNAME ## _pixels8_l2_8(block, pixels, pixels + line_size,
\
line_size, line_size, line_size, h); \
line_size, line_size, line_size, h); \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels4_x2)(uint8_t *block,
\
static inline void
OPNAME ## _pixels4_x2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
FUNC(OPNAME ## _pixels4_l2)(block, pixels, pixels + sizeof(pixel),
\
OPNAME ## _pixels4_l2_8(block, pixels, pixels + 1,
\
line_size, line_size, line_size, h); \
line_size, line_size, line_size, h); \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels4_y2)(uint8_t *block,
\
static inline void
OPNAME ## _pixels4_y2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
FUNC(OPNAME ## _pixels4_l2)(block, pixels, pixels + line_size,
\
OPNAME ## _pixels4_l2_8(block, pixels, pixels + line_size,
\
line_size, line_size, line_size, h); \
line_size, line_size, line_size, h); \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels2_x2)(uint8_t *block,
\
static inline void
OPNAME ## _pixels2_x2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
FUNC(OPNAME ## _pixels2_l2)(block, pixels, pixels + sizeof(pixel),
\
OPNAME ## _pixels2_l2_8(block, pixels, pixels + 1,
\
line_size, line_size, line_size, h); \
line_size, line_size, line_size, h); \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels2_y2)(uint8_t *block,
\
static inline void
OPNAME ## _pixels2_y2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
FUNC(OPNAME ## _pixels2_l2)(block, pixels, pixels + line_size,
\
OPNAME ## _pixels2_l2_8(block, pixels, pixels + line_size,
\
line_size, line_size, line_size, h); \
line_size, line_size, line_size, h); \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels2_xy2)(uint8_t *_block,
\
static inline void
OPNAME ## _pixels2_xy2_8_c(uint8_t *block,
\
const uint8_t *_pixels,
\
const uint8_t *pixels,
\
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
{ \
{ \
pixel *block = (pixel *) _block; \
const pixel *pixels = (const pixel *) _pixels; \
int i, a1, b1; \
int i, a1, b1; \
int a0 = pixels[0]; \
int a0 = pixels[0]; \
int b0 = pixels[1] + 2; \
int b0 = pixels[1] + 2; \
\
\
a0 += b0; \
a0 += b0; \
b0 += pixels[2]; \
b0 += pixels[2]; \
line_size /= sizeof(pixel); \
pixels += line_size; \
pixels += line_size; \
for (i = 0; i < h; i += 2) { \
for (i = 0; i < h; i += 2) { \
a1 = pixels[0]; \
a1 = pixels[0]; \
...
@@ -170,7 +162,7 @@ static inline void FUNCC(OPNAME ## _pixels2_xy2)(uint8_t *_block, \
...
@@ -170,7 +162,7 @@ static inline void FUNCC(OPNAME ## _pixels2_xy2)(uint8_t *_block, \
} \
} \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels4_xy2)(uint8_t *block,
\
static inline void
OPNAME ## _pixels4_xy2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
...
@@ -212,7 +204,7 @@ static inline void FUNCC(OPNAME ## _pixels4_xy2)(uint8_t *block, \
...
@@ -212,7 +204,7 @@ static inline void FUNCC(OPNAME ## _pixels4_xy2)(uint8_t *block, \
} \
} \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block,
\
static inline void
OPNAME ## _pixels8_xy2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
...
@@ -260,7 +252,7 @@ static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, \
...
@@ -260,7 +252,7 @@ static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, \
} \
} \
} \
} \
\
\
static inline void
FUNCC(OPNAME ## _no_rnd_pixels8_xy2)(uint8_t *block,
\
static inline void
OPNAME ## _no_rnd_pixels8_xy2_8_c(uint8_t *block,
\
const uint8_t *pixels, \
const uint8_t *pixels, \
ptrdiff_t line_size, \
ptrdiff_t line_size, \
int h) \
int h) \
...
@@ -308,34 +300,32 @@ static inline void FUNCC(OPNAME ## _no_rnd_pixels8_xy2)(uint8_t *block, \
...
@@ -308,34 +300,32 @@ static inline void FUNCC(OPNAME ## _no_rnd_pixels8_xy2)(uint8_t *block, \
} \
} \
} \
} \
\
\
CALL_2X_PIXELS(
FUNCC(OPNAME ## _pixels16_x2),
\
CALL_2X_PIXELS(
OPNAME ## _pixels16_x2_8_c,
\
FUNCC(OPNAME ## _pixels8_x2),
\
OPNAME ## _pixels8_x2_8_c,
\
8
* sizeof(pixel))
\
8
)
\
CALL_2X_PIXELS(
FUNCC(OPNAME ## _pixels16_y2),
\
CALL_2X_PIXELS(
OPNAME ## _pixels16_y2_8_c,
\
FUNCC(OPNAME ## _pixels8_y2),
\
OPNAME ## _pixels8_y2_8_c,
\
8
* sizeof(pixel))
\
8
)
\
CALL_2X_PIXELS(
FUNCC(OPNAME ## _pixels16_xy2),
\
CALL_2X_PIXELS(
OPNAME ## _pixels16_xy2_8_c,
\
FUNCC(OPNAME ## _pixels8_xy2),
\
OPNAME ## _pixels8_xy2_8_c,
\
8
* sizeof(pixel))
\
8
)
\
av_unused CALL_2X_PIXELS(
FUNCC(OPNAME ## _no_rnd_pixels16),
\
av_unused CALL_2X_PIXELS(
OPNAME ## _no_rnd_pixels16_8_c,
\
FUNCC(OPNAME ## _pixels8),
\
OPNAME ## _pixels8_8_c,
\
8
* sizeof(pixel))
\
8
)
\
CALL_2X_PIXELS(
FUNCC(OPNAME ## _no_rnd_pixels16_x2),
\
CALL_2X_PIXELS(
OPNAME ## _no_rnd_pixels16_x2_8_c,
\
FUNCC(OPNAME ## _no_rnd_pixels8_x2),
\
OPNAME ## _no_rnd_pixels8_x2_8_c,
\
8
* sizeof(pixel))
\
8
)
\
CALL_2X_PIXELS(
FUNCC(OPNAME ## _no_rnd_pixels16_y2),
\
CALL_2X_PIXELS(
OPNAME ## _no_rnd_pixels16_y2_8_c,
\
FUNCC(OPNAME ## _no_rnd_pixels8_y2),
\
OPNAME ## _no_rnd_pixels8_y2_8_c,
\
8
* sizeof(pixel))
\
8
)
\
CALL_2X_PIXELS(
FUNCC(OPNAME ## _no_rnd_pixels16_xy2),
\
CALL_2X_PIXELS(
OPNAME ## _no_rnd_pixels16_xy2_8_c,
\
FUNCC(OPNAME ## _no_rnd_pixels8_xy2),
\
OPNAME ## _no_rnd_pixels8_xy2_8_c,
\
8
* sizeof(pixel))
\
8
)
\
#define op_avg(a, b) a = rnd_avg
_pixel4
(a, b)
#define op_avg(a, b) a = rnd_avg
32
(a, b)
#define op_put(a, b) a = b
#define op_put(a, b) a = b
#if BIT_DEPTH == 8
#define put_no_rnd_pixels8_8_c put_pixels8_8_c
#define put_no_rnd_pixels8_8_c put_pixels8_8_c
PIXOP2
(
avg
,
op_avg
)
PIXOP2
(
avg
,
op_avg
)
PIXOP2
(
put
,
op_put
)
PIXOP2
(
put
,
op_put
)
#endif
#undef op_avg
#undef op_avg
#undef op_put
#undef op_put
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