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
a3e75626
Commit
a3e75626
authored
Jan 06, 2014
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bfin: dsputil: K&R formatting cosmetics
Also add a few #endif comments.
parent
1e33095b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
94 deletions
+112
-94
config_bfin.h
libavcodec/bfin/config_bfin.h
+21
-20
dsputil_bfin.c
libavcodec/bfin/dsputil_bfin.c
+63
-57
dsputil_bfin.h
libavcodec/bfin/dsputil_bfin.h
+28
-17
No files found.
libavcodec/bfin/config_bfin.h
View file @
a3e75626
...
...
@@ -17,16 +17,17 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
low level assembler interface wrapper
DEFUN(put_pixels_clamped,mL1,
(int16_t *block, uint8_t *dest, int line_size)):
body
rts;
*/
/*
* low level assembler interface wrapper
*
* DEFUN(put_pixels_clamped,mL1,
* (int16_t *block, uint8_t *dest, int line_size)):
*
* body
*
* rts;
*/
#ifndef AVCODEC_BFIN_CONFIG_BFIN_H
#define AVCODEC_BFIN_CONFIG_BFIN_H
...
...
@@ -42,24 +43,24 @@ DEFUN(put_pixels_clamped,mL1,
#else
#define mL1 mL3
#endif
#endif
#endif
/* mL1 */
#define DEFUN(fname,
where,interface)
\
.section where;
\
.global _ff_bfin_ ## fname ;
\
.type _ff_bfin_ ## fname, STT_FUNC;
\
.align 8;
\
_ff_bfin_ ## fname
#define DEFUN(fname,
where, interface)
\
.section where;
\
.global _ff_bfin_ ## fname;
\
.type _ff_bfin_ ## fname, STT_FUNC;
\
.align 8;
\
_ff_bfin_ ## fname
#define DEFUN_END(fname) \
.size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname
.size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname
#ifdef __FDPIC__
#define RELOC(reg,
got,
obj) reg = [got + obj@GOT17M4]
#define RELOC(reg,
got,
obj) reg = [got + obj@GOT17M4]
#else
#define RELOC(reg,
got,
obj) reg.L = obj; reg.H = obj
#define RELOC(reg,
got,
obj) reg.L = obj; reg.H = obj
#endif
#endif
#endif
/* DEFUN */
#endif
/* AVCODEC_BFIN_CONFIG_BFIN_H */
libavcodec/bfin/dsputil_bfin.c
View file @
a3e75626
...
...
@@ -26,108 +26,115 @@
#include "libavcodec/dsputil.h"
#include "dsputil_bfin.h"
static
void
bfin_idct_add
(
uint8_t
*
dest
,
int
line_size
,
int16_t
*
block
)
static
void
bfin_idct_add
(
uint8_t
*
dest
,
int
line_size
,
int16_t
*
block
)
{
ff_bfin_idct
(
block
);
ff_bfin_add_pixels_clamped
(
block
,
dest
,
line_size
);
ff_bfin_idct
(
block
);
ff_bfin_add_pixels_clamped
(
block
,
dest
,
line_size
);
}
static
void
bfin_idct_put
(
uint8_t
*
dest
,
int
line_size
,
int16_t
*
block
)
static
void
bfin_idct_put
(
uint8_t
*
dest
,
int
line_size
,
int16_t
*
block
)
{
ff_bfin_idct
(
block
);
ff_bfin_put_pixels_clamped
(
block
,
dest
,
line_size
);
ff_bfin_idct
(
block
);
ff_bfin_put_pixels_clamped
(
block
,
dest
,
line_size
);
}
static
void
bfin_clear_blocks
(
int16_t
*
blocks
)
static
void
bfin_clear_blocks
(
int16_t
*
blocks
)
{
// This is just a simple memset.
//
__asm__
(
"P0=192; "
"I0=%0; "
"R0=0; "
"LSETUP(clear_blocks_blkfn_lab,clear_blocks_blkfn_lab)LC0=P0;"
"clear_blocks_blkfn_lab:"
"[I0++]=R0;"
::
"a"
(
blocks
)
:
"P0"
,
"I0"
,
"R0"
);
__asm__
(
"P0=192; "
"I0=%0; "
"R0=0; "
"LSETUP(clear_blocks_blkfn_lab,clear_blocks_blkfn_lab)LC0=P0;"
"clear_blocks_blkfn_lab:"
"[I0++]=R0;"
::
"a"
(
blocks
)
:
"P0"
,
"I0"
,
"R0"
);
}
static
int
bfin_pix_abs16
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
static
int
bfin_pix_abs16
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
{
return
ff_bfin_z_sad16x16
(
blk1
,
blk2
,
line_size
,
line_size
,
h
);
return
ff_bfin_z_sad16x16
(
blk1
,
blk2
,
line_size
,
line_size
,
h
);
}
static
uint8_t
vtmp_blk
[
256
]
attribute_l1_data_b
;
static
int
bfin_pix_abs16_x2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
static
int
bfin_pix_abs16_x2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
{
ff_bfin_put_pixels16uc
(
vtmp_blk
,
blk2
,
blk2
+
1
,
16
,
line_size
,
h
);
return
ff_bfin_z_sad16x16
(
blk1
,
vtmp_blk
,
line_size
,
16
,
h
);
ff_bfin_put_pixels16uc
(
vtmp_blk
,
blk2
,
blk2
+
1
,
16
,
line_size
,
h
);
return
ff_bfin_z_sad16x16
(
blk1
,
vtmp_blk
,
line_size
,
16
,
h
);
}
static
int
bfin_pix_abs16_y2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
static
int
bfin_pix_abs16_y2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
{
ff_bfin_put_pixels16uc
(
vtmp_blk
,
blk2
,
blk2
+
line_size
,
16
,
line_size
,
h
);
return
ff_bfin_z_sad16x16
(
blk1
,
vtmp_blk
,
line_size
,
16
,
h
);
ff_bfin_put_pixels16uc
(
vtmp_blk
,
blk2
,
blk2
+
line_size
,
16
,
line_size
,
h
);
return
ff_bfin_z_sad16x16
(
blk1
,
vtmp_blk
,
line_size
,
16
,
h
);
}
static
int
bfin_pix_abs16_xy2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
static
int
bfin_pix_abs16_xy2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
{
ff_bfin_z_put_pixels16_xy2
(
vtmp_blk
,
blk2
,
16
,
line_size
,
h
);
return
ff_bfin_z_sad16x16
(
blk1
,
vtmp_blk
,
line_size
,
16
,
h
);
ff_bfin_z_put_pixels16_xy2
(
vtmp_blk
,
blk2
,
16
,
line_size
,
h
);
return
ff_bfin_z_sad16x16
(
blk1
,
vtmp_blk
,
line_size
,
16
,
h
);
}
static
int
bfin_pix_abs8
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
static
int
bfin_pix_abs8
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
{
return
ff_bfin_z_sad8x8
(
blk1
,
blk2
,
line_size
,
line_size
,
h
);
return
ff_bfin_z_sad8x8
(
blk1
,
blk2
,
line_size
,
line_size
,
h
);
}
static
int
bfin_pix_abs8_x2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
static
int
bfin_pix_abs8_x2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
{
ff_bfin_put_pixels8uc
(
vtmp_blk
,
blk2
,
blk2
+
1
,
8
,
line_size
,
h
);
return
ff_bfin_z_sad8x8
(
blk1
,
vtmp_blk
,
line_size
,
8
,
h
);
ff_bfin_put_pixels8uc
(
vtmp_blk
,
blk2
,
blk2
+
1
,
8
,
line_size
,
h
);
return
ff_bfin_z_sad8x8
(
blk1
,
vtmp_blk
,
line_size
,
8
,
h
);
}
static
int
bfin_pix_abs8_y2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
static
int
bfin_pix_abs8_y2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
{
ff_bfin_put_pixels8uc
(
vtmp_blk
,
blk2
,
blk2
+
line_size
,
8
,
line_size
,
h
);
return
ff_bfin_z_sad8x8
(
blk1
,
vtmp_blk
,
line_size
,
8
,
h
);
ff_bfin_put_pixels8uc
(
vtmp_blk
,
blk2
,
blk2
+
line_size
,
8
,
line_size
,
h
);
return
ff_bfin_z_sad8x8
(
blk1
,
vtmp_blk
,
line_size
,
8
,
h
);
}
static
int
bfin_pix_abs8_xy2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
static
int
bfin_pix_abs8_xy2
(
void
*
c
,
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
line_size
,
int
h
)
{
ff_bfin_z_put_pixels8_xy2
(
vtmp_blk
,
blk2
,
8
,
line_size
,
h
);
return
ff_bfin_z_sad8x8
(
blk1
,
vtmp_blk
,
line_size
,
8
,
h
);
ff_bfin_z_put_pixels8_xy2
(
vtmp_blk
,
blk2
,
8
,
line_size
,
h
);
return
ff_bfin_z_sad8x8
(
blk1
,
vtmp_blk
,
line_size
,
8
,
h
);
}
/*
decoder optimization
start on 2/11 100 frames of 352x240@25 compiled with no optimization -g debugging
9.824s ~ 2.44x off
6.360s ~ 1.58x off with -O2
5.740s ~ 1.43x off with idcts
2.64s 2/20 same sman.mp4 decode only
*/
* decoder optimization
* start on 2/11 100 frames of 352x240@25 compiled with no optimization -g debugging
* 9.824s ~ 2.44x off
* 6.360s ~ 1.58x off with -O2
* 5.740s ~ 1.43x off with idcts
*
* 2.64s 2/20 same sman.mp4 decode only
*/
av_cold
void
ff_dsputil_init_bfin
(
DSPContext
*
c
,
AVCodecContext
*
avctx
)
{
const
int
high_bit_depth
=
avctx
->
bits_per_raw_sample
>
8
;
c
->
diff_pixels
=
ff_bfin_diff_pixels
;
c
->
diff_pixels
=
ff_bfin_diff_pixels
;
c
->
put_pixels_clamped
=
ff_bfin_put_pixels_clamped
;
c
->
add_pixels_clamped
=
ff_bfin_add_pixels_clamped
;
if
(
!
high_bit_depth
)
c
->
get_pixels
=
ff_bfin_get_pixels
;
c
->
clear_blocks
=
bfin_clear_blocks
;
c
->
pix_sum
=
ff_bfin_pix_sum
;
c
->
pix_norm1
=
ff_bfin_pix_norm1
;
c
->
get_pixels
=
ff_bfin_get_pixels
;
c
->
clear_blocks
=
bfin_clear_blocks
;
c
->
sad
[
0
]
=
bfin_pix_abs16
;
c
->
sad
[
1
]
=
bfin_pix_abs8
;
c
->
pix_sum
=
ff_bfin_pix_sum
;
c
->
pix_norm1
=
ff_bfin_pix_norm1
;
c
->
sad
[
0
]
=
bfin_pix_abs16
;
c
->
sad
[
1
]
=
bfin_pix_abs8
;
/* TODO [0] 16 [1] 8 */
c
->
pix_abs
[
0
][
0
]
=
bfin_pix_abs16
;
...
...
@@ -140,14 +147,13 @@ av_cold void ff_dsputil_init_bfin(DSPContext *c, AVCodecContext *avctx)
c
->
pix_abs
[
1
][
2
]
=
bfin_pix_abs8_y2
;
c
->
pix_abs
[
1
][
3
]
=
bfin_pix_abs8_xy2
;
c
->
sse
[
0
]
=
ff_bfin_sse16
;
c
->
sse
[
1
]
=
ff_bfin_sse8
;
c
->
sse
[
2
]
=
ff_bfin_sse4
;
if
(
avctx
->
bits_per_raw_sample
<=
8
)
{
if
(
avctx
->
dct_algo
==
FF_DCT_AUTO
)
c
->
fdct
=
ff_bfin_fdct
;
c
->
fdct
=
ff_bfin_fdct
;
if
(
avctx
->
idct_algo
==
FF_IDCT_AUTO
)
{
c
->
idct_permutation_type
=
FF_NO_IDCT_PERM
;
...
...
libavcodec/bfin/dsputil_bfin.h
View file @
a3e75626
...
...
@@ -20,7 +20,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_BFIN_DSPUTIL_BFIN_H
#define AVCODEC_BFIN_DSPUTIL_BFIN_H
...
...
@@ -29,27 +28,39 @@
#include "config.h"
#if defined(__FDPIC__) && CONFIG_SRAM
#define attribute_l1_text
__attribute__
((l1_text))
#define attribute_l1_text
__attribute__
((l1_text))
#define attribute_l1_data_b __attribute__((l1_data_B))
#else
#define attribute_l1_text
#define attribute_l1_data_b
#endif
void
ff_bfin_idct
(
int16_t
*
block
)
attribute_l1_text
;
void
ff_bfin_fdct
(
int16_t
*
block
)
attribute_l1_text
;
void
ff_bfin_add_pixels_clamped
(
const
int16_t
*
block
,
uint8_t
*
dest
,
int
line_size
)
attribute_l1_text
;
void
ff_bfin_put_pixels_clamped
(
const
int16_t
*
block
,
uint8_t
*
dest
,
int
line_size
)
attribute_l1_text
;
void
ff_bfin_diff_pixels
(
int16_t
*
block
,
const
uint8_t
*
s1
,
const
uint8_t
*
s2
,
int
stride
)
attribute_l1_text
;
void
ff_bfin_get_pixels
(
int16_t
*
restrict
block
,
const
uint8_t
*
pixels
,
int
line_size
)
attribute_l1_text
;
int
ff_bfin_pix_norm1
(
uint8_t
*
pix
,
int
line_size
)
attribute_l1_text
;
int
ff_bfin_z_sad8x8
(
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
dsz
,
int
line_size
,
int
h
)
attribute_l1_text
;
int
ff_bfin_z_sad16x16
(
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
dsz
,
int
line_size
,
int
h
)
attribute_l1_text
;
int
ff_bfin_pix_sum
(
uint8_t
*
p
,
int
stride
)
attribute_l1_text
;
int
ff_bfin_sse4
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
)
attribute_l1_text
;
int
ff_bfin_sse8
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
)
attribute_l1_text
;
int
ff_bfin_sse16
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
)
attribute_l1_text
;
void
ff_bfin_idct
(
int16_t
*
block
)
attribute_l1_text
;
void
ff_bfin_fdct
(
int16_t
*
block
)
attribute_l1_text
;
void
ff_bfin_add_pixels_clamped
(
const
int16_t
*
block
,
uint8_t
*
dest
,
int
line_size
)
attribute_l1_text
;
void
ff_bfin_put_pixels_clamped
(
const
int16_t
*
block
,
uint8_t
*
dest
,
int
line_size
)
attribute_l1_text
;
void
ff_bfin_diff_pixels
(
int16_t
*
block
,
const
uint8_t
*
s1
,
const
uint8_t
*
s2
,
int
stride
)
attribute_l1_text
;
void
ff_bfin_get_pixels
(
int16_t
*
restrict
block
,
const
uint8_t
*
pixels
,
int
line_size
)
attribute_l1_text
;
int
ff_bfin_pix_norm1
(
uint8_t
*
pix
,
int
line_size
)
attribute_l1_text
;
int
ff_bfin_pix_sum
(
uint8_t
*
p
,
int
stride
)
attribute_l1_text
;
int
ff_bfin_z_sad8x8
(
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
dsz
,
int
line_size
,
int
h
)
attribute_l1_text
;
int
ff_bfin_z_sad16x16
(
uint8_t
*
blk1
,
uint8_t
*
blk2
,
int
dsz
,
int
line_size
,
int
h
)
attribute_l1_text
;
int
ff_bfin_sse4
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
)
attribute_l1_text
;
int
ff_bfin_sse8
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
)
attribute_l1_text
;
int
ff_bfin_sse16
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
)
attribute_l1_text
;
#endif
/* AVCODEC_BFIN_DSPUTIL_BFIN_H */
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