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
74652af8
Commit
74652af8
authored
Apr 26, 2013
by
Janne Grunau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pixdesc: add function to return pixel format with swapped endiannes
parent
6e293d11
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
1 deletion
+60
-1
pixdesc.c
libavutil/pixdesc.c
+48
-0
pixdesc.h
libavutil/pixdesc.h
+11
-0
version.h
libavutil/version.h
+1
-1
No files found.
libavutil/pixdesc.c
View file @
74652af8
...
...
@@ -1512,3 +1512,51 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
ret
+=
planes
[
i
];
return
ret
;
}
enum
AVPixelFormat
av_pix_fmt_swap_endianness
(
enum
AVPixelFormat
pix_fmt
)
{
#define PIX_FMT_SWAP_ENDIANNESS(fmt) \
case AV_PIX_FMT_ ## fmt ## BE: return AV_PIX_FMT_ ## fmt ## LE; \
case AV_PIX_FMT_ ## fmt ## LE: return AV_PIX_FMT_ ## fmt ## BE
switch
(
pix_fmt
)
{
PIX_FMT_SWAP_ENDIANNESS
(
GRAY16
);
PIX_FMT_SWAP_ENDIANNESS
(
RGB48
);
PIX_FMT_SWAP_ENDIANNESS
(
RGB565
);
PIX_FMT_SWAP_ENDIANNESS
(
RGB555
);
PIX_FMT_SWAP_ENDIANNESS
(
RGB444
);
PIX_FMT_SWAP_ENDIANNESS
(
BGR48
);
PIX_FMT_SWAP_ENDIANNESS
(
BGR565
);
PIX_FMT_SWAP_ENDIANNESS
(
BGR555
);
PIX_FMT_SWAP_ENDIANNESS
(
BGR444
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV420P9
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV422P9
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV444P9
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV420P10
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV422P10
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV444P10
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV420P16
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV422P16
);
PIX_FMT_SWAP_ENDIANNESS
(
YUV444P16
);
PIX_FMT_SWAP_ENDIANNESS
(
GBRP9
);
PIX_FMT_SWAP_ENDIANNESS
(
GBRP10
);
PIX_FMT_SWAP_ENDIANNESS
(
GBRP16
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA420P9
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA422P9
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA444P9
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA420P10
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA422P10
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA444P10
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA420P16
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA422P16
);
PIX_FMT_SWAP_ENDIANNESS
(
YUVA444P16
);
PIX_FMT_SWAP_ENDIANNESS
(
XYZ12
);
default:
return
AV_PIX_FMT_NONE
;
}
#undef PIX_FMT_SWAP_ENDIANNESS
}
libavutil/pixdesc.h
View file @
74652af8
...
...
@@ -226,4 +226,15 @@ int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
int
av_pix_fmt_count_planes
(
enum
AVPixelFormat
pix_fmt
);
/**
* Utility function to swap the endianness of a pixel format.
*
* @param[in] pix_fmt the pixel format
*
* @return pixel format with swapped endianness if it exists,
* otherwise AV_PIX_FMT_NONE
*/
enum
AVPixelFormat
av_pix_fmt_swap_endianness
(
enum
AVPixelFormat
pix_fmt
);
#endif
/* AVUTIL_PIXDESC_H */
libavutil/version.h
View file @
74652af8
...
...
@@ -38,7 +38,7 @@
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 10
#define LIBAVUTIL_VERSION_MICRO
0
#define LIBAVUTIL_VERSION_MICRO
1
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
...
...
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