From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 998384452F for ; Wed, 14 Sep 2022 16:48:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8335568BB39; Wed, 14 Sep 2022 19:48:50 +0300 (EEST) Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6818668BA8D for ; Wed, 14 Sep 2022 19:48:44 +0300 (EEST) Received: by mail-yb1-f171.google.com with SMTP id b136so23709913yba.2 for ; Wed, 14 Sep 2022 09:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :from:to:cc:subject:date; bh=dKoSOP9XozFay5t5x+S7KERuFbxVLBpWD2ck9KnxP4M=; b=AC/0DdKJubfqL/zAlQoFjS9ppGTtkVckoK9M0gi3fl20Qm1mdHOlLmfeki1IDdOn6s ZEflvX/hiNB36CIDRzZjUkaPv1CDyMMaI7AsaGRhWDNiT2w8uDL6aZw37jeZtJi3EANR KeYekMhHcUmaZkgUvMwOlIL+xRO6vC/pMwJ9FhqgDAL8PdR0Z+kvOS0MrCfQ+D2Yo0af mmFT6zBqQWNwrw9zAOlJw/7C/wW5sQAXUtqjxuVN8MJJW3QHH4psSCGG8UsN27CXjEH6 QBNmLQOEds/yOpdCKE5HDl1xyLREJSs/kbnQd6fF5xmOqV9C/Ymcsq0dEEdizVBL3sz9 Fb6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :x-gm-message-state:from:to:cc:subject:date; bh=dKoSOP9XozFay5t5x+S7KERuFbxVLBpWD2ck9KnxP4M=; b=n45duZcuUqhFdV0KeO6tCkWAatC1wtnHZmz9GQb40OvCyYLLx0RJyCUcs7NnZoGSHT ek+bJNgPaTGKuBoKIMCViYgDOeicHFJ4sS0tHZJDUFhjfddG7LQqyZYGUUsJSBFADN0a pMRsZlnPivarE+I53tR09E6ZiLFzYtiY3DXxvEFv2e6N2uxjGRDst1okC00Q0wHULZU5 LT1ntAK9/Mlux7YJ0+mJgo09CuyHxQUuUv3Lp5R+qyd9PYI85hwZWxKvD0WcoFM5t2N5 R6OasCTrUZ192HCC0HLuqvU6UmZ8VcJvTb0RRZ5qxjNZyEJseJPYBcAeLJ926ukoZ8Fz f/bg== X-Gm-Message-State: ACgBeo3tzxV/Al1wqSBKvXhr6tYQx/yoJFVS+OTF1kvlYGrI0YpcYGfB SFZ5I3nenXWKeN+JutDF2d+MF+3lGHjzvhAow812mWe8 X-Google-Smtp-Source: AA6agR7nJ9bL8fStB+hSzcG93AgoO8s/t3t5ShpeDEb4N5XCYWeFRHeVlqmAeatjo0V0F+HX6CpULFNTb/qzt3kfHjM= X-Received: by 2002:a5b:485:0:b0:67c:2c89:f3a3 with SMTP id n5-20020a5b0485000000b0067c2c89f3a3mr29552722ybp.571.1663174122737; Wed, 14 Sep 2022 09:48:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a81:7402:0:0:0:0:0 with HTTP; Wed, 14 Sep 2022 09:48:42 -0700 (PDT) In-Reply-To: <032c01d8c855$10d7c0a0$328741e0$@gmx.de> References: <032c01d8c855$10d7c0a0$328741e0$@gmx.de> From: Paul B Mahol Date: Wed, 14 Sep 2022 18:48:42 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] Bug in VMAF calculation for 10 bit comparison X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 9/14/22, christian.feldmann@gmx.de wrote: > Hi, > > I was debugging some VMAF calculation in ffmpeg when I stumbled on this bug > in the latest master commit (9450f759748d02d1d284d2e4afd741cb0fe0c04a). Its > in libavfilter/vf_libvmaf.c::109. The function copy_picture_data does only > work correctly for 8 bit input. For 10 bit input, only half of the width of > the input picture is copied. But for 10 bit inputs, 2 bytes per pixel must > be copied. Please see this patch: > > Patch is messed up, please either attach it as attachment or provide it in some other way. > > libavfilter/vf_libvmaf.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c > > index eee1c280ef..8d5ba4e2d5 100644 > > --- a/libavfilter/vf_libvmaf.c > > +++ b/libavfilter/vf_libvmaf.c > > @@ -108,6 +108,7 @@ static enum VmafPixelFormat pix_fmt_map(enum > AVPixelFormat av_pix_fmt) > > static int copy_picture_data(AVFrame *src, VmafPicture *dst, unsigned bpc) > > { > > + const int bytes_per_value = bpc > 8 ? 2 : 1; > > int err = vmaf_picture_alloc(dst, pix_fmt_map(src->format), bpc, > > src->width, src->height); > > if (err) > > @@ -117,7 +118,7 @@ static int copy_picture_data(AVFrame *src, VmafPicture > *dst, unsigned bpc) > > uint8_t *src_data = src->data[i]; > > uint8_t *dst_data = dst->data[i]; > > for (unsigned j = 0; j < dst->h[i]; j++) { > > - memcpy(dst_data, src_data, sizeof(*dst_data) * dst->w[i]); > > + memcpy(dst_data, src_data, bytes_per_value * dst->w[i]); > > src_data += src->linesize[i]; > > dst_data += dst->stride[i]; > > } > > -- > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".