Browse code

avutil/pixdesc: check for component overlap

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/04/16 22:10:13
Showing 1 changed files
... ...
@@ -1835,6 +1835,10 @@ void ff_check_pixfmt_descriptors(void){
1835 1835
 
1836 1836
     for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
1837 1837
         const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
1838
+        uint8_t fill[4][8+6+3] = {{0}};
1839
+        uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
1840
+        int linesize[4] = {0,0,0,0};
1841
+        uint16_t tmp[2];
1838 1842
 
1839 1843
         if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
1840 1844
             continue;
... ...
@@ -1857,6 +1861,10 @@ void ff_check_pixfmt_descriptors(void){
1857 1857
             } else {
1858 1858
                 av_assert0(8*(c->step_minus1+1) >= c->depth_minus1+1);
1859 1859
             }
1860
+            av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
1861
+            av_assert0(tmp[0] == 0 && tmp[1] == 0);
1862
+            tmp[0] = tmp[1] = (1<<(c->depth_minus1 + 1)) - 1;
1863
+            av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
1860 1864
         }
1861 1865
     }
1862 1866
 }