[FFmpeg-cvslog] showinfo: fix computation of Adler checksum

Stefano Sabatini git at videolan.org
Sun May 15 12:36:06 CEST 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Sat May 14 13:20:52 2011 +0200| [bb82ea797fb6538308af84310118d8006b150318] | committer: Stefano Sabatini

showinfo: fix computation of Adler checksum

Previously the code was computing the checksum only for the first line
of each plane.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb82ea797fb6538308af84310118d8006b150318
---

 libavfilter/vf_showinfo.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index d512199..30e1108 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -43,13 +43,19 @@ static void end_frame(AVFilterLink *inlink)
     AVFilterContext *ctx = inlink->dst;
     ShowInfoContext *showinfo = ctx->priv;
     AVFilterBufferRef *picref = inlink->cur_buf;
-    uint32_t plane_crc[4], crc = 0;
-    int plane;
+    uint32_t plane_crc[4] = {0}, crc = 0;
+    int i, plane, vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
 
-    for (plane = 0; plane < 4; plane++) {
+    for (plane = 0; picref->data[plane] && plane < 4; plane++) {
         size_t linesize = av_image_get_linesize(picref->format, picref->video->w, plane);
-        plane_crc[plane] = av_adler32_update(0  , picref->data[plane], linesize);
-        crc              = av_adler32_update(crc, picref->data[plane], linesize);
+        uint8_t *data = picref->data[plane];
+        int h = plane == 1 || plane == 2 ? inlink->h >> vsub : inlink->h;
+
+        for (i = 0; i < h; i++) {
+            plane_crc[plane] = av_adler32_update(plane_crc[plane], data, linesize);
+            crc = av_adler32_update(crc, data, linesize);
+            data += picref->linesize[plane];
+        }
     }
 
     av_log(ctx, AV_LOG_INFO,



More information about the ffmpeg-cvslog mailing list