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
20e99a9c
Commit
20e99a9c
authored
Apr 16, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/pixdesc: support for self-checking the descriptors
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
1314f534
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
0 deletions
+29
-0
pixdesc.c
libavutil/pixdesc.c
+25
-0
pixdesc.h
libavutil/pixdesc.h
+1
-0
utils.c
libavutil/utils.c
+3
-0
No files found.
libavutil/pixdesc.c
View file @
20e99a9c
...
...
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
#include "avassert.h"
#include "common.h"
#include "pixfmt.h"
#include "pixdesc.h"
...
...
@@ -1828,3 +1829,27 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
ret
+=
planes
[
i
];
return
ret
;
}
void
ff_check_pixfmt_descriptors
(
void
){
int
i
,
j
;
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
av_pix_fmt_descriptors
);
i
++
)
{
const
AVPixFmtDescriptor
*
d
=
&
av_pix_fmt_descriptors
[
i
];
if
(
!
d
->
name
&&
!
d
->
nb_components
&&
!
d
->
log2_chroma_w
&&
!
d
->
log2_chroma_h
&&
!
d
->
flags
)
continue
;
// av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
av_assert0
(
d
->
log2_chroma_w
<=
3
);
av_assert0
(
d
->
log2_chroma_h
<=
3
);
av_assert0
(
d
->
nb_components
<=
4
);
av_assert0
(
d
->
name
&&
d
->
name
[
0
]);
av_assert0
((
d
->
nb_components
==
4
||
d
->
nb_components
==
2
)
==
!!
(
d
->
flags
&
PIX_FMT_ALPHA
));
av_assert2
(
av_get_pix_fmt
(
d
->
name
)
==
i
);
for
(
j
=
0
;
j
<
FF_ARRAY_ELEMS
(
d
->
comp
);
j
++
)
{
const
AVComponentDescriptor
*
c
=
&
d
->
comp
[
j
];
if
(
j
>=
d
->
nb_components
)
av_assert0
(
!
c
->
plane
&&
!
c
->
step_minus1
&&
!
c
->
offset_plus1
&&
!
c
->
shift
&&
!
c
->
depth_minus1
);
}
}
}
libavutil/pixdesc.h
View file @
20e99a9c
...
...
@@ -239,5 +239,6 @@ int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
*/
int
av_pix_fmt_count_planes
(
enum
AVPixelFormat
pix_fmt
);
void
ff_check_pixfmt_descriptors
(
void
);
#endif
/* AVUTIL_PIXDESC_H */
libavutil/utils.c
View file @
20e99a9c
...
...
@@ -20,6 +20,7 @@
#include "avutil.h"
#include "avassert.h"
#include "samplefmt.h"
#include "pixdesc.h"
/**
* @file
...
...
@@ -40,6 +41,8 @@ unsigned avutil_version(void)
abort
();
}
ff_check_pixfmt_descriptors
();
return
LIBAVUTIL_VERSION_INT
;
}
...
...
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