Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer authored on 2013/04/16 21:16:03... | ... |
@@ -22,6 +22,7 @@ |
22 | 22 |
#include <stdio.h> |
23 | 23 |
#include <string.h> |
24 | 24 |
|
25 |
+#include "avassert.h" |
|
25 | 26 |
#include "common.h" |
26 | 27 |
#include "pixfmt.h" |
27 | 28 |
#include "pixdesc.h" |
... | ... |
@@ -1828,3 +1829,27 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt) |
1828 | 1828 |
ret += planes[i]; |
1829 | 1829 |
return ret; |
1830 | 1830 |
} |
1831 |
+ |
|
1832 |
+void ff_check_pixfmt_descriptors(void){ |
|
1833 |
+ int i, j; |
|
1834 |
+ |
|
1835 |
+ for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) { |
|
1836 |
+ const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i]; |
|
1837 |
+ |
|
1838 |
+ if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags) |
|
1839 |
+ continue; |
|
1840 |
+// av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name); |
|
1841 |
+ av_assert0(d->log2_chroma_w <= 3); |
|
1842 |
+ av_assert0(d->log2_chroma_h <= 3); |
|
1843 |
+ av_assert0(d->nb_components <= 4); |
|
1844 |
+ av_assert0(d->name && d->name[0]); |
|
1845 |
+ av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & PIX_FMT_ALPHA)); |
|
1846 |
+ av_assert2(av_get_pix_fmt(d->name) == i); |
|
1847 |
+ |
|
1848 |
+ for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) { |
|
1849 |
+ const AVComponentDescriptor *c = &d->comp[j]; |
|
1850 |
+ if(j>=d->nb_components) |
|
1851 |
+ av_assert0(!c->plane && !c->step_minus1 && !c->offset_plus1 && !c->shift && !c->depth_minus1); |
|
1852 |
+ } |
|
1853 |
+ } |
|
1854 |
+} |
... | ... |
@@ -20,6 +20,7 @@ |
20 | 20 |
#include "avutil.h" |
21 | 21 |
#include "avassert.h" |
22 | 22 |
#include "samplefmt.h" |
23 |
+#include "pixdesc.h" |
|
23 | 24 |
|
24 | 25 |
/** |
25 | 26 |
* @file |
... | ... |
@@ -40,6 +41,8 @@ unsigned avutil_version(void) |
40 | 40 |
abort(); |
41 | 41 |
} |
42 | 42 |
|
43 |
+ ff_check_pixfmt_descriptors(); |
|
44 |
+ |
|
43 | 45 |
return LIBAVUTIL_VERSION_INT; |
44 | 46 |
} |
45 | 47 |
|