[PATCH 1/2] Implement ff_fill_pointer test.

Stefano Sabatini stefano.sabatini-lala
Mon Apr 5 00:28:30 CEST 2010


---
 libavcodec/imgconvert.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 0fb2fe6..e525930 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -1546,3 +1546,39 @@ int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
     return 0;
 }
 
+#if TEST
+
+#undef printf
+
+void show_linesizes(int linesize[4]);
+void show_data_size(int     data[4]);
+
+void show_linesizes(int linesize[4])
+{
+    printf("%d %d %d %d\n", linesize[0], linesize[1], linesize[2], linesize[3]);
+}
+
+void show_data_size(int data[4])
+{
+    printf("%d %d %d\n", data[1]-data[0], data[2]-data[1], data[3]-data[2]);
+}
+
+int main(void)
+{
+    enum PixelFormat pix_fmt;
+    int i, sizes[] = { 0, 1, 2, 3, 24, 234, 434234, 2, 0, 25, 27, 124, 2345, 23556, 234545 };
+
+    for (i = 0; i < FF_ARRAY_ELEMS(sizes); i++) {
+        for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++) {
+            AVPicture *pict  = av_malloc(sizeof(AVPicture));
+
+            ff_fill_linesize(pict,  pix_fmt, sizes[i]);
+            printf("%s[%d]: ", avcodec_get_pix_fmt_name(pix_fmt), sizes[i]);
+            show_linesizes(pict->linesize);
+        }
+    }
+
+    return 0;
+}
+
+#endif  /* TEST */
-- 
1.7.0


--7JfCtLOvnd9MIVvH
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-Make-ff_fill_linesize-use-the-information-stored-in.patch"




More information about the ffmpeg-devel mailing list