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
f1148390
Commit
f1148390
authored
Feb 08, 2016
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sws/aarch64: add {nv12,nv21,yuv420p,yuv422p}_to_{argb,rgba,abgr,rgba}_neon
parent
7bcc57ad
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
345 additions
and
0 deletions
+345
-0
Makefile
libswscale/aarch64/Makefile
+3
-0
swscale_unscaled.c
libswscale/aarch64/swscale_unscaled.c
+132
-0
yuv2rgb_neon.S
libswscale/aarch64/yuv2rgb_neon.S
+207
-0
swscale_internal.h
libswscale/swscale_internal.h
+1
-0
swscale_unscaled.c
libswscale/swscale_unscaled.c
+2
-0
No files found.
libswscale/aarch64/Makefile
0 → 100644
View file @
f1148390
OBJS
+=
aarch64/swscale_unscaled.o
NEON-OBJS
+=
aarch64/yuv2rgb_neon.o
libswscale/aarch64/swscale_unscaled.c
0 → 100644
View file @
f1148390
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
#include "libavutil/aarch64/cpu.h"
#define YUV_TO_RGB_TABLE \
c->yuv2rgb_v2r_coeff, \
c->yuv2rgb_u2g_coeff, \
c->yuv2rgb_v2g_coeff, \
c->yuv2rgb_u2b_coeff, \
#define DECLARE_FF_YUVX_TO_RGBX_FUNCS(ifmt, ofmt) \
int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \
uint8_t *dst, int linesize, \
const uint8_t *srcY, int linesizeY, \
const uint8_t *srcU, int linesizeU, \
const uint8_t *srcV, int linesizeV, \
const int16_t *table, \
int y_offset, \
int y_coeff); \
\
static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \
int srcStride[], int srcSliceY, int srcSliceH, \
uint8_t *dst[], int dstStride[]) { \
const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
\
ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \
dst[0] + srcSliceY * dstStride[0], dstStride[0], \
src[0], srcStride[0], \
src[1], srcStride[1], \
src[2], srcStride[2], \
yuv2rgb_table, \
c->yuv2rgb_y_offset >> 6, \
c->yuv2rgb_y_coeff); \
return 0; \
} \
#define DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuvx) \
DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, argb) \
DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, rgba) \
DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, abgr) \
DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, bgra) \
DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS
(
yuv420p
)
DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS
(
yuv422p
)
#define DECLARE_FF_NVX_TO_RGBX_FUNCS(ifmt, ofmt) \
int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \
uint8_t *dst, int linesize, \
const uint8_t *srcY, int linesizeY, \
const uint8_t *srcC, int linesizeC, \
const int16_t *table, \
int y_offset, \
int y_coeff); \
\
static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \
int srcStride[], int srcSliceY, int srcSliceH, \
uint8_t *dst[], int dstStride[]) { \
const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
\
ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \
dst[0] + srcSliceY * dstStride[0], dstStride[0], \
src[0], srcStride[0], src[1], srcStride[1], \
yuv2rgb_table, \
c->yuv2rgb_y_offset >> 6, \
c->yuv2rgb_y_coeff); \
\
return 0; \
} \
#define DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx) \
DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, argb) \
DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, rgba) \
DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, abgr) \
DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgra) \
DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS
(
nv12
)
DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS
(
nv21
)
/* We need a 16 pixel width alignment. This constraint can easily be removed
* for input reading but for the output which is 4-bytes per pixel (RGBA) the
* assembly might be writing as much as 4*15=60 extra bytes at the end of the
* line, which won't fit the 32-bytes buffer alignment. */
#define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \
if (c->srcFormat == AV_PIX_FMT_##IFMT \
&& c->dstFormat == AV_PIX_FMT_##OFMT \
&& !(c->srcH & 1) \
&& !(c->srcW & 15) \
&& !accurate_rnd) \
c->swscale = ifmt##_to_##ofmt##_neon_wrapper; \
} while (0)
#define SET_FF_NVX_TO_ALL_RGBX_FUNC(nvx, NVX, accurate_rnd) do { \
SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, argb, ARGB, accurate_rnd); \
SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, rgba, RGBA, accurate_rnd); \
SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, abgr, ABGR, accurate_rnd); \
SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, bgra, BGRA, accurate_rnd); \
} while (0)
static
void
get_unscaled_swscale_neon
(
SwsContext
*
c
)
{
int
accurate_rnd
=
c
->
flags
&
SWS_ACCURATE_RND
;
SET_FF_NVX_TO_ALL_RGBX_FUNC
(
nv12
,
NV12
,
accurate_rnd
);
SET_FF_NVX_TO_ALL_RGBX_FUNC
(
nv21
,
NV21
,
accurate_rnd
);
SET_FF_NVX_TO_ALL_RGBX_FUNC
(
yuv420p
,
YUV420P
,
accurate_rnd
);
SET_FF_NVX_TO_ALL_RGBX_FUNC
(
yuv422p
,
YUV422P
,
accurate_rnd
);
}
void
ff_get_unscaled_swscale_aarch64
(
SwsContext
*
c
)
{
int
cpu_flags
=
av_get_cpu_flags
();
if
(
have_neon
(
cpu_flags
))
get_unscaled_swscale_neon
(
c
);
}
libswscale/aarch64/yuv2rgb_neon.S
0 → 100644
View file @
f1148390
This diff is collapsed.
Click to expand it.
libswscale/swscale_internal.h
View file @
f1148390
...
...
@@ -877,6 +877,7 @@ extern const AVClass ff_sws_context_class;
void
ff_get_unscaled_swscale
(
SwsContext
*
c
);
void
ff_get_unscaled_swscale_ppc
(
SwsContext
*
c
);
void
ff_get_unscaled_swscale_arm
(
SwsContext
*
c
);
void
ff_get_unscaled_swscale_aarch64
(
SwsContext
*
c
);
/**
* Return function pointer to fastest main scaler path function depending
...
...
libswscale/swscale_unscaled.c
View file @
f1148390
...
...
@@ -1779,6 +1779,8 @@ void ff_get_unscaled_swscale(SwsContext *c)
ff_get_unscaled_swscale_ppc
(
c
);
if
(
ARCH_ARM
)
ff_get_unscaled_swscale_arm
(
c
);
if
(
ARCH_AARCH64
)
ff_get_unscaled_swscale_aarch64
(
c
);
}
/* Convert the palette to the same packed 32-bit format as the palette */
...
...
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