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
874f1a90
Commit
874f1a90
authored
Jul 21, 2011
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsputil: template get_pixels() for different bit depths
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
5cc26009
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
39 additions
and
30 deletions
+39
-30
dsputil_alpha.c
libavcodec/alpha/dsputil_alpha.c
+2
-1
dsputil_init_armv6.c
libavcodec/arm/dsputil_init_armv6.c
+2
-1
dsputil_bfin.c
libavcodec/bfin/dsputil_bfin.c
+1
-1
dsputil.c
libavcodec/dsputil.c
+1
-20
dsputil_template.c
libavcodec/dsputil_template.c
+23
-0
dsputil_mlib.c
libavcodec/mlib/dsputil_mlib.c
+2
-1
dsputil_altivec.c
libavcodec/ppc/dsputil_altivec.c
+2
-3
dsputil_mmi.c
libavcodec/ps2/dsputil_mmi.c
+1
-1
dsputilenc_mmx.c
libavcodec/x86/dsputilenc_mmx.c
+5
-2
No files found.
libavcodec/alpha/dsputil_alpha.c
View file @
874f1a90
...
@@ -321,7 +321,8 @@ void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
...
@@ -321,7 +321,8 @@ void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
c
->
put_pixels_clamped
=
put_pixels_clamped_mvi_asm
;
c
->
put_pixels_clamped
=
put_pixels_clamped_mvi_asm
;
c
->
add_pixels_clamped
=
add_pixels_clamped_mvi_asm
;
c
->
add_pixels_clamped
=
add_pixels_clamped_mvi_asm
;
c
->
get_pixels
=
get_pixels_mvi
;
if
(
!
high_bit_depth
)
c
->
get_pixels
=
get_pixels_mvi
;
c
->
diff_pixels
=
diff_pixels_mvi
;
c
->
diff_pixels
=
diff_pixels_mvi
;
c
->
sad
[
0
]
=
pix_abs16x16_mvi_asm
;
c
->
sad
[
0
]
=
pix_abs16x16_mvi_asm
;
c
->
sad
[
1
]
=
pix_abs8x8_mvi
;
c
->
sad
[
1
]
=
pix_abs8x8_mvi
;
...
...
libavcodec/arm/dsputil_init_armv6.c
View file @
874f1a90
...
@@ -106,8 +106,9 @@ void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
...
@@ -106,8 +106,9 @@ void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
c
->
avg_pixels_tab
[
1
][
0
]
=
ff_avg_pixels8_armv6
;
c
->
avg_pixels_tab
[
1
][
0
]
=
ff_avg_pixels8_armv6
;
}
}
if
(
!
high_bit_depth
)
c
->
get_pixels
=
ff_get_pixels_armv6
;
c
->
add_pixels_clamped
=
ff_add_pixels_clamped_armv6
;
c
->
add_pixels_clamped
=
ff_add_pixels_clamped_armv6
;
c
->
get_pixels
=
ff_get_pixels_armv6
;
c
->
diff_pixels
=
ff_diff_pixels_armv6
;
c
->
diff_pixels
=
ff_diff_pixels_armv6
;
c
->
pix_abs
[
0
][
0
]
=
ff_pix_abs16_armv6
;
c
->
pix_abs
[
0
][
0
]
=
ff_pix_abs16_armv6
;
...
...
libavcodec/bfin/dsputil_bfin.c
View file @
874f1a90
...
@@ -199,12 +199,12 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
...
@@ -199,12 +199,12 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
{
{
const
int
high_bit_depth
=
avctx
->
codec_id
==
CODEC_ID_H264
&&
avctx
->
bits_per_raw_sample
>
8
;
const
int
high_bit_depth
=
avctx
->
codec_id
==
CODEC_ID_H264
&&
avctx
->
bits_per_raw_sample
>
8
;
c
->
get_pixels
=
ff_bfin_get_pixels
;
c
->
diff_pixels
=
ff_bfin_diff_pixels
;
c
->
diff_pixels
=
ff_bfin_diff_pixels
;
c
->
put_pixels_clamped
=
ff_bfin_put_pixels_clamped
;
c
->
put_pixels_clamped
=
ff_bfin_put_pixels_clamped
;
c
->
add_pixels_clamped
=
ff_bfin_add_pixels_clamped
;
c
->
add_pixels_clamped
=
ff_bfin_add_pixels_clamped
;
if
(
!
high_bit_depth
)
if
(
!
high_bit_depth
)
c
->
get_pixels
=
ff_bfin_get_pixels
;
c
->
clear_blocks
=
bfin_clear_blocks
;
c
->
clear_blocks
=
bfin_clear_blocks
;
c
->
pix_sum
=
ff_bfin_pix_sum
;
c
->
pix_sum
=
ff_bfin_pix_sum
;
c
->
pix_norm1
=
ff_bfin_pix_norm1
;
c
->
pix_norm1
=
ff_bfin_pix_norm1
;
...
...
libavcodec/dsputil.c
View file @
874f1a90
...
@@ -307,25 +307,6 @@ static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
...
@@ -307,25 +307,6 @@ static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
return
s
;
return
s
;
}
}
static
void
get_pixels_c
(
DCTELEM
*
restrict
block
,
const
uint8_t
*
pixels
,
int
line_size
)
{
int
i
;
/* read the pixels */
for
(
i
=
0
;
i
<
8
;
i
++
)
{
block
[
0
]
=
pixels
[
0
];
block
[
1
]
=
pixels
[
1
];
block
[
2
]
=
pixels
[
2
];
block
[
3
]
=
pixels
[
3
];
block
[
4
]
=
pixels
[
4
];
block
[
5
]
=
pixels
[
5
];
block
[
6
]
=
pixels
[
6
];
block
[
7
]
=
pixels
[
7
];
pixels
+=
line_size
;
block
+=
8
;
}
}
static
void
diff_pixels_c
(
DCTELEM
*
restrict
block
,
const
uint8_t
*
s1
,
static
void
diff_pixels_c
(
DCTELEM
*
restrict
block
,
const
uint8_t
*
s1
,
const
uint8_t
*
s2
,
int
stride
){
const
uint8_t
*
s2
,
int
stride
){
int
i
;
int
i
;
...
@@ -2927,7 +2908,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
...
@@ -2927,7 +2908,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
}
}
}
}
c
->
get_pixels
=
get_pixels_c
;
c
->
diff_pixels
=
diff_pixels_c
;
c
->
diff_pixels
=
diff_pixels_c
;
c
->
put_pixels_clamped
=
ff_put_pixels_clamped_c
;
c
->
put_pixels_clamped
=
ff_put_pixels_clamped_c
;
c
->
put_signed_pixels_clamped
=
ff_put_signed_pixels_clamped_c
;
c
->
put_signed_pixels_clamped
=
ff_put_signed_pixels_clamped_c
;
...
@@ -3160,6 +3140,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
...
@@ -3160,6 +3140,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
#define BIT_DEPTH_FUNCS(depth, dct)\
#define BIT_DEPTH_FUNCS(depth, dct)\
c->get_pixels = FUNCC(get_pixels ## dct , depth);\
c->draw_edges = FUNCC(draw_edges , depth);\
c->draw_edges = FUNCC(draw_edges , depth);\
c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\
c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\
c->clear_block = FUNCC(clear_block ## dct , depth);\
c->clear_block = FUNCC(clear_block ## dct , depth);\
...
...
libavcodec/dsputil_template.c
View file @
874f1a90
...
@@ -193,6 +193,29 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, i
...
@@ -193,6 +193,29 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, i
}
}
#define DCTELEM_FUNCS(dctcoef, suffix) \
#define DCTELEM_FUNCS(dctcoef, suffix) \
static void FUNCC(get_pixels ## suffix)(DCTELEM *restrict _block, \
const uint8_t *_pixels, \
int line_size) \
{ \
const pixel *pixels = (const pixel *) _pixels; \
dctcoef *restrict block = (dctcoef *) _block; \
int i; \
\
/* read the pixels */
\
for(i=0;i<8;i++) { \
block[0] = pixels[0]; \
block[1] = pixels[1]; \
block[2] = pixels[2]; \
block[3] = pixels[3]; \
block[4] = pixels[4]; \
block[5] = pixels[5]; \
block[6] = pixels[6]; \
block[7] = pixels[7]; \
pixels += line_size / sizeof(pixel); \
block += 8; \
} \
} \
\
static void FUNCC(add_pixels8 ## suffix)(uint8_t *restrict _pixels, \
static void FUNCC(add_pixels8 ## suffix)(uint8_t *restrict _pixels, \
DCTELEM *_block, \
DCTELEM *_block, \
int line_size) \
int line_size) \
...
...
libavcodec/mlib/dsputil_mlib.c
View file @
874f1a90
...
@@ -423,11 +423,12 @@ void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx)
...
@@ -423,11 +423,12 @@ void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx)
{
{
const
int
high_bit_depth
=
avctx
->
codec_id
==
CODEC_ID_H264
&&
avctx
->
bits_per_raw_sample
>
8
;
const
int
high_bit_depth
=
avctx
->
codec_id
==
CODEC_ID_H264
&&
avctx
->
bits_per_raw_sample
>
8
;
c
->
get_pixels
=
get_pixels_mlib
;
c
->
diff_pixels
=
diff_pixels_mlib
;
c
->
diff_pixels
=
diff_pixels_mlib
;
c
->
add_pixels_clamped
=
add_pixels_clamped_mlib
;
c
->
add_pixels_clamped
=
add_pixels_clamped_mlib
;
if
(
!
high_bit_depth
)
{
if
(
!
high_bit_depth
)
{
c
->
get_pixels
=
get_pixels_mlib
;
c
->
put_pixels_tab
[
0
][
0
]
=
put_pixels16_mlib
;
c
->
put_pixels_tab
[
0
][
0
]
=
put_pixels16_mlib
;
c
->
put_pixels_tab
[
0
][
1
]
=
put_pixels16_x2_mlib
;
c
->
put_pixels_tab
[
0
][
1
]
=
put_pixels16_x2_mlib
;
c
->
put_pixels_tab
[
0
][
2
]
=
put_pixels16_y2_mlib
;
c
->
put_pixels_tab
[
0
][
2
]
=
put_pixels16_y2_mlib
;
...
...
libavcodec/ppc/dsputil_altivec.c
View file @
874f1a90
...
@@ -1387,11 +1387,10 @@ void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx)
...
@@ -1387,11 +1387,10 @@ void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx)
c
->
sse
[
0
]
=
sse16_altivec
;
c
->
sse
[
0
]
=
sse16_altivec
;
c
->
pix_sum
=
pix_sum_altivec
;
c
->
pix_sum
=
pix_sum_altivec
;
c
->
diff_pixels
=
diff_pixels_altivec
;
c
->
diff_pixels
=
diff_pixels_altivec
;
c
->
get_pixels
=
get_pixels_altivec
;
if
(
!
high_bit_depth
)
c
->
clear_block
=
clear_block_altivec
;
c
->
add_bytes
=
add_bytes_altivec
;
c
->
add_bytes
=
add_bytes_altivec
;
if
(
!
high_bit_depth
)
{
if
(
!
high_bit_depth
)
{
c
->
get_pixels
=
get_pixels_altivec
;
c
->
clear_block
=
clear_block_altivec
;
c
->
put_pixels_tab
[
0
][
0
]
=
put_pixels16_altivec
;
c
->
put_pixels_tab
[
0
][
0
]
=
put_pixels16_altivec
;
/* the two functions do the same thing, so use the same code */
/* the two functions do the same thing, so use the same code */
c
->
put_no_rnd_pixels_tab
[
0
][
0
]
=
put_pixels16_altivec
;
c
->
put_no_rnd_pixels_tab
[
0
][
0
]
=
put_pixels16_altivec
;
...
...
libavcodec/ps2/dsputil_mmi.c
View file @
874f1a90
...
@@ -152,9 +152,9 @@ void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx)
...
@@ -152,9 +152,9 @@ void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx)
c
->
put_pixels_tab
[
0
][
0
]
=
put_pixels16_mmi
;
c
->
put_pixels_tab
[
0
][
0
]
=
put_pixels16_mmi
;
c
->
put_no_rnd_pixels_tab
[
0
][
0
]
=
put_pixels16_mmi
;
c
->
put_no_rnd_pixels_tab
[
0
][
0
]
=
put_pixels16_mmi
;
}
c
->
get_pixels
=
get_pixels_mmi
;
c
->
get_pixels
=
get_pixels_mmi
;
}
if
(
avctx
->
bits_per_raw_sample
<=
8
&&
if
(
avctx
->
bits_per_raw_sample
<=
8
&&
(
idct_algo
==
FF_IDCT_AUTO
||
idct_algo
==
FF_IDCT_PS2
))
{
(
idct_algo
==
FF_IDCT_AUTO
||
idct_algo
==
FF_IDCT_PS2
))
{
...
...
libavcodec/x86/dsputilenc_mmx.c
View file @
874f1a90
...
@@ -1098,6 +1098,7 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
...
@@ -1098,6 +1098,7 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
void
dsputilenc_init_mmx
(
DSPContext
*
c
,
AVCodecContext
*
avctx
)
void
dsputilenc_init_mmx
(
DSPContext
*
c
,
AVCodecContext
*
avctx
)
{
{
int
mm_flags
=
av_get_cpu_flags
();
int
mm_flags
=
av_get_cpu_flags
();
int
bit_depth
=
avctx
->
bits_per_raw_sample
;
if
(
mm_flags
&
AV_CPU_FLAG_MMX
)
{
if
(
mm_flags
&
AV_CPU_FLAG_MMX
)
{
const
int
dct_algo
=
avctx
->
dct_algo
;
const
int
dct_algo
=
avctx
->
dct_algo
;
...
@@ -1112,7 +1113,8 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
...
@@ -1112,7 +1113,8 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
}
}
}
}
c
->
get_pixels
=
get_pixels_mmx
;
if
(
bit_depth
<=
8
)
c
->
get_pixels
=
get_pixels_mmx
;
c
->
diff_pixels
=
diff_pixels_mmx
;
c
->
diff_pixels
=
diff_pixels_mmx
;
c
->
pix_sum
=
pix_sum16_mmx
;
c
->
pix_sum
=
pix_sum16_mmx
;
...
@@ -1159,7 +1161,8 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
...
@@ -1159,7 +1161,8 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
}
}
if
(
mm_flags
&
AV_CPU_FLAG_SSE2
){
if
(
mm_flags
&
AV_CPU_FLAG_SSE2
){
c
->
get_pixels
=
get_pixels_sse2
;
if
(
bit_depth
<=
8
)
c
->
get_pixels
=
get_pixels_sse2
;
c
->
sum_abs_dctelem
=
sum_abs_dctelem_sse2
;
c
->
sum_abs_dctelem
=
sum_abs_dctelem_sse2
;
#if HAVE_YASM && HAVE_ALIGNED_STACK
#if HAVE_YASM && HAVE_ALIGNED_STACK
c
->
hadamard8_diff
[
0
]
=
ff_hadamard8_diff16_sse2
;
c
->
hadamard8_diff
[
0
]
=
ff_hadamard8_diff16_sse2
;
...
...
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