From patchwork Tue Sep 28 13:36:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 30628 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp5210341iob; Tue, 28 Sep 2021 06:36:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweKmePSh0FWZPamy05wuIdg6hZ2jZYfWuJL7ijqCP7uh1fYhZaNoCgVsj3dl+QVnicJEVi X-Received: by 2002:adf:de02:: with SMTP id b2mr80609wrm.42.1632836219505; Tue, 28 Sep 2021 06:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632836219; cv=none; d=google.com; s=arc-20160816; b=i1zsCtkT2vIVx9489Am1fa8wGafTW8OG53fo3f021Km+qw8OCvqLOcYVmgb+fWfm9G 678J2eRn0LbkGcrFSj3PPOJe1L+TBmgB0i1mZaH070mPGtM59zN8jgK30YFgvJK6yeP0 1u63SFug8kYVFsQfkxq9e2KA0Kx2nl06uBYfc8+Iuy1NkOOmBOIM6P42MwrYzBLm7QmL aF8hOrNEztRmVn7Myqk+kQrkw0uTgtVsY8+JhMJGbT3U1bCMsBmt9wK/Dh9Ua6bMlvTy QF5yF4lzfHd2U6R2bD2UevRuGxNZQx6g9deiM641zq7k61BpygrZaoSw6E1nVxylKygZ xQSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=BO56SZ1PTIPr50/Sn/AFppdEzkIl6zorxkGHgRryq8Y=; b=0SBXCtZoqoXUR9i20MOA2Hqtr0BBHqvaRG/3SKgpkOBQQ5cDpucY0X2qUH7FE/kRkR CiiULqjGldEOYUc6sSjCErQ8Hwu5qLf/DrWZLzxZwtcbossdmDScdTCADZckNnC5yzKn TJwh5+Eyl5EeDLqI4205OoPTPTcC2cP/wR2V8t7pOpogg3KbN3H0Wpmhl5D6yAYbIxw1 CIItlYAjbplSPeGr6tMnh9kZob2oaeOQHMUY57YHIlA3zOyObg6worI7dORFqf2xR0m1 oY9ZWDfOYxBCzf7tRgqUPEpDSZszPJlx1Edn5DwuwPBrW8lwQL9/dCwkl+x0hCQz2VaJ bezg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=TP+qmiVC; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o4si12336202edc.451.2021.09.28.06.36.58; Tue, 28 Sep 2021 06:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=TP+qmiVC; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5EA2E6898E4; Tue, 28 Sep 2021 16:36:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3BF24680CEA for ; Tue, 28 Sep 2021 16:36:49 +0300 (EEST) Received: by mail-pl1-f175.google.com with SMTP id c4so14206733pls.6 for ; Tue, 28 Sep 2021 06:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=BjI2UbByN7eRUjhacCujTne5OCZN+5Of379qs3q/TQE=; b=TP+qmiVCqYziakgesVBsHpfMc6GW1069xlePNwwFbMNx84yWMdamw0fY9c8IK5JyDF N1d5HBA9ch1aCE2br3UK2vcN9WWV0lJE2DnhtLJuVv5D/5qtf+XCZTPQp4IOyT2WtVHR 5NEA9U7mJiHz8imc0CKb7IuhJf7QSZlyK4+AiTHAk+F/uAtegqrswU6KjxX5hUVyk3f0 O64Z0482SQIzaP+zwR/W/qaYQ7kJ48CDa+Wg11m1uyk3J+BD3L1YVIYhnVjpPAQKK8lt zJwtg3dMDXgTg1N2mgi38sPZq11ncuaBWKCOJT2yh4qdTrRuU+i/ZeQCaNAsEC5MsjZ2 +ngQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BjI2UbByN7eRUjhacCujTne5OCZN+5Of379qs3q/TQE=; b=4nvqNdhVqAInzzU5VF9Ss3fXkE/kT0ySw5tSrweJiPIR/lgrc7VSSv3p4BJKaTNi3b fg0xdSJUvJbVRNMOZdeYLGUOlT6dUICjCGAljvW7Xk+JoVAbzuB0EM56qD+5Zsag54gv 3wvci+W7UecBY+Ga1K9OeFrg4MuU5A4DjEMGtYn6PZKi4n1DjNBmsByD1llc6LC71mqO Y7rE7RVxhAwX+C4cBVgP65u2t9cHX3WNqHw6ErpazYzzEaekUgBfAJC5Yv79TR6Ufz6h USMhF7yk3cNxxEGkUQzprcPuO5Q2loAr2Tmzpk4mARHbi01+8L1Ood1YceprAX0RcXvi kOZA== X-Gm-Message-State: AOAM5321Sjv5in84wQTNy62A0zzqtNZnbGcpV8VBX+6WZwyHp3JknEuY 7fZhg5JF+u8qsM1dit/VPYCvJ+8PC0E= X-Received: by 2002:a17:90a:1b2a:: with SMTP id q39mr5584332pjq.219.1632836207322; Tue, 28 Sep 2021 06:36:47 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id u6sm21636839pgr.3.2021.09.28.06.36.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Sep 2021 06:36:47 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Sep 2021 21:36:35 +0800 Message-Id: <1632836198-23044-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 1/4] avutil/detection_bbox: fix the memory leak on error 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WLB29P/RoN9e From: Limin Wang Signed-off-by: Limin Wang --- libavutil/detection_bbox.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c index 40711e6..d066567 100644 --- a/libavutil/detection_bbox.c +++ b/libavutil/detection_bbox.c @@ -61,6 +61,7 @@ AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32 } if (!av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_DETECTION_BBOXES, buf)) { + av_freep(&header); av_buffer_unref(&buf); return NULL; } From patchwork Tue Sep 28 13:36:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 30627 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp5210505iob; Tue, 28 Sep 2021 06:37:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAUbDNT1xyw9ES7alvg6eLBNhNT4Hsx2mZ2aefemOIzOeAVUsrERmQ4Xx8LlZGIUHVXzvl X-Received: by 2002:a50:d84c:: with SMTP id v12mr7674845edj.201.1632836229434; Tue, 28 Sep 2021 06:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632836229; cv=none; d=google.com; s=arc-20160816; b=fpFFyvOIkVRvdViQ9cbZ5HlAx+pwztOa+ZLJF5b2L9/EwbIISbmxyow0tsgQJuOi1X 3+2wnjQ8HErm4fqQW8nZmFM2NTRbCjzxaktWjpFq5ZfzisA8lvs2+DtRqixW01RKFmD9 9N+m4zb9+tzbjXo0f5DE243tdqw5UmtUti8ZsdPTVtpONDOI/Z+W1M5pPtzbV0zaVy/j HJjZy4HC9jh83b+VJY4kxqWOwA4fEvKvpB3zlwh3Oly9lA2NwgWdKx+THdLc/EiKpVp3 WdLSPdE4yFdJeqjCpE+clGWqX083JZFiK/t7j/8Vtg5c29H834zkCb2DiXzyY2rJIVUk jhbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=f2go03zz6hBxYefOFdOfHVmNIZdUKbp5Ww9z1otDtSo=; b=woH+AN7E0cjo6rni20o8mBvFFYVTgFuIMUxi7G0rDL2gq9Wl294CoYhaMydpSDK3aR OdYuG0n5AAlqV/FuR4YC/N+6vtBQEtUEZ/fjhZKi2EPw3uDKUVACKohotNWJpSH7gjcX MAsK+6yNYWi6zQscx4Xu1w3wwVF3qg++LmJw5rMqazuqrkbSAipOQ5zeTLPc186GteDz svwfOdqBVBlfwi8bdY2N3Rw+r5fm07lvswhHa7JvCc9AxB4P9q6poi+A8j29GRnhseuQ l10CqRla4u/UwG+b2ry18p2VvPx/CvNYdd7ShQ5O9iBBpgJ1sNm/eHsb3fxL9fxcIZTi mr3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="Wh/GmYFr"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x15si395004ede.404.2021.09.28.06.37.09; Tue, 28 Sep 2021 06:37:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="Wh/GmYFr"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5F966687F27; Tue, 28 Sep 2021 16:36:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7525C6898FB for ; Tue, 28 Sep 2021 16:36:50 +0300 (EEST) Received: by mail-pf1-f171.google.com with SMTP id 145so18946360pfz.11 for ; Tue, 28 Sep 2021 06:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WL7kp/hGprFiG7LAMkWMPIgYsllxpAqzOLJkx3ss+hA=; b=Wh/GmYFrH9cxGbMEjo7Yxjt5gPVoOMm65Tx4wYefjA+mHSGegPcXT920mXnJXKOp4A lOTAUJZ9qSYxn+J97B7vvpKVlVhzj/cc9L4EVHmPC4ZHfJTZY+B73yDnt+Z4Un08fZuQ dEt+ZJfjmOk0Z7LnI3d0+3gEzpb6rfx29Hg7lUT55KIYLT6wL17ZpjLSckU0xDehH8Wu jdrk7XCxAhnCLH2WvnLH7tRtNt1qxGRpuhHNC29EXwbLC/KjyWH4diqkfniwEqPEVzct v7RM1T2j5Ym2J5GxaaTCowP8Q0C/CcecYZjU6grLNIMxnJYcW20w944XW/BPIpjhJCYT xe5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WL7kp/hGprFiG7LAMkWMPIgYsllxpAqzOLJkx3ss+hA=; b=iDhIeefeIoP8JtWjNTJJwXuFFu7ZXaDWE469vZToi6LvfObjseJjJ+tqCCnogX4uvC FOnio9V+jvB+ZqYKAU8jFR9PPiDQdgINilZeTpxob3+eG0byZVdMIJH/x5nitMRUEvRG qbh2F/WJ33R3bZ0Zmv7KZApoAqgQn9YClwq2JX5hCm9+X45nkC6oZCREEzAAE6lHQh5v MUsrh2joaT37qFteE+FsmdgXv+VoIIX9WN6aDwS5dlvO/pytIaZC3rs3nZKMuc6uV10Q q015qFlcj4tIsS06JBIqMTu4drknnz05OqEadGDREqxwZUw6Q+rEGQrRKy0TLE5qv4hY ZMfA== X-Gm-Message-State: AOAM532seY9naSnpJAQjkRGufdvGrgcz6LaWyCdUFxGIxg8ejDZO05rI raSUKVX3fG4uiN4KolFOUFzVMct1T3Y= X-Received: by 2002:aa7:959a:0:b0:43b:adeb:ef58 with SMTP id z26-20020aa7959a000000b0043badebef58mr5360811pfj.19.1632836208555; Tue, 28 Sep 2021 06:36:48 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id u6sm21636839pgr.3.2021.09.28.06.36.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Sep 2021 06:36:48 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Sep 2021 21:36:36 +0800 Message-Id: <1632836198-23044-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1632836198-23044-1-git-send-email-lance.lmwang@gmail.com> References: <1632836198-23044-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/4] avutil/detection_bbox: use offsetof for bboxes_offset 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: vj3hiUel0IxL From: Limin Wang Signed-off-by: Limin Wang --- libavutil/detection_bbox.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c index d066567..8bfdff7 100644 --- a/libavutil/detection_bbox.c +++ b/libavutil/detection_bbox.c @@ -21,10 +21,11 @@ AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size) { size_t size; - struct { + struct BBoxContext { AVDetectionBBoxHeader header; AVDetectionBBox boxes[1]; } *ret; + const size_t bboxes_offset = offsetof(struct BBoxContext, boxes); size = sizeof(*ret); if (nb_bboxes - 1 > (SIZE_MAX - size) / sizeof(*ret->boxes)) @@ -37,7 +38,7 @@ AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_s ret->header.nb_bboxes = nb_bboxes; ret->header.bbox_size = sizeof(*ret->boxes); - ret->header.bboxes_offset = (char *)&ret->boxes - (char *)&ret->header; + ret->header.bboxes_offset = bboxes_offset; if (out_size) *out_size = size; From patchwork Tue Sep 28 13:36:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 30629 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp5210641iob; Tue, 28 Sep 2021 06:37:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMxj5OXTXDNPVdV5saI7UTrGYLaIO4GhjsU2AopeCMUhALrv2m8mDXKjH63wwaldEF1F4i X-Received: by 2002:a17:906:31cf:: with SMTP id f15mr6745816ejf.272.1632836239760; Tue, 28 Sep 2021 06:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632836239; cv=none; d=google.com; s=arc-20160816; b=n1EXI/f86lgDaQM2zTpg7gqfYgt2l1AZ4ya3QqWaKI+kbZJEnbLXfjH55XBkdWQG4k H3Kcpd/azU8aHyaJkAReRHu+f/0aDacUZMJkkOB3hc+j1/2viZvCSX/UIsqItKRiia3r EFBB7kc5Nlba1syqd27UpG+oR55khjTpAsV66Cae0P4ow9XZDUraXAHDku7HlDFk93iF GSoSjczR3XOLEzC772TDCnDz+gJVHCKsZ4B6izNJpQAKnDm07OQLWcd7S0uYQceUaobK hY7UWc5Yni83P7uKYugdIqStdT2/gQ45YZRutB1ovlEaEjta/1xQO98o3CchdSVXwTio HsMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=Hgpj8mf4YDJQizQgbNWShLIy9GdBFoSLGlodPwYssO0=; b=K9VT4Z44n5yt0IUUvS++aaXloPJaK1bdSFXFQl1R7FTomkkX6vKoXtuAZh2pkL5AiJ GEMHKqA9rmbYZ8o6RGAlFrtD/GCCg0IiKAXO0r/9RbzeTxU5N6kunvAO3hZMXE2UA7gA 1OZqzTur64c+FRds59n2IWSHtBLtchQxEVld35iQ8AWNfxxqU0VbksBzUi0od3UkDa0K DRhRsR9Kk1vW08iUb7zod51ZbLwOXUf41UataJaj6LcJXrWhOUNpDgwWatwyXbnO+/rE 9CNPsmQ1JiGc2J/TWv+F3IKibwLNtwbNWo5iIZje1yCflG1wK/1zrX9/7Ut4IpmDPSRI znEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="RCricVA/"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 30si23700534eji.702.2021.09.28.06.37.18; Tue, 28 Sep 2021 06:37:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="RCricVA/"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4B5B1689F59; Tue, 28 Sep 2021 16:36:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8BDD9688057 for ; Tue, 28 Sep 2021 16:36:51 +0300 (EEST) Received: by mail-pl1-f172.google.com with SMTP id bb10so14223702plb.2 for ; Tue, 28 Sep 2021 06:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Gf+BGRC9JkpyW/lG/u3yLFGEE+kwkuA9Lwt82+RNiQk=; b=RCricVA/OxKhcOX+AayiZcAbc3o+Tu7A4y+5MZ/BB/A/tGtuZjHcSTx6eQYEx9qVq+ 1tzXd4/s30aDmsAdIN+kV1qmA4nMcNO8y1pktobpjId81ufekSlBK/vWKmG4uKHzNXow oPXRV12UqkniYQySf4XuiRmPLGPpR3NqqY0k+p3XRjymN2kUN3s64FO8v3gzOtjlNI7T kuszmXjQSqCPZtXwHKU/T8PqBU26W/Ayq5HvkKggOs7yGuZldVRMJ540i6vxwK64eo95 cC4LVLQDS1XYHu9YcyEFxDfOZefNfijP55WdD9qx6zPzPyrwcJ5YuaoycWCCQmaRdyr+ snxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Gf+BGRC9JkpyW/lG/u3yLFGEE+kwkuA9Lwt82+RNiQk=; b=C/Yo1qOadNuV5+EYCEjjw8AZ7q8GXh2zT8xmzzP26PI9lwB83OGFkPY8GPxgDwsCG0 U5PchDgV8Pp3+xMla8jEC/JaZspmiLtu7UJGS5rkkSAcYYp2a1RFLpYhtjnsbLSe3UgR kSVJ7fXJGfR5fNCGnzExxFEqNRNMl31rXWlq/kenebirDm5L7rsmSduLKiM9HWaejEhd q7sjNwL8gC3bkZz3oFUD3/LSW7I+UpKatYRBFNeGfh72Plz8MBq3NlVSWrtIDikAbw1H uK4DwhCQXC5RDzE73Ibh5Gw+gJDSZFY8wAXu55X+8Fx7DUK+jhVZN8n1cMFKmsbMnZur cmcQ== X-Gm-Message-State: AOAM531m11iPsZRFqt+rBCKnk0o5DucUYd9VcOAL4iyn0Mw6jFexTOn4 UFYXYjud9H2NQeX5vBDtIE5LsUVt+cI= X-Received: by 2002:a17:90a:e7cd:: with SMTP id kb13mr32634pjb.52.1632836209815; Tue, 28 Sep 2021 06:36:49 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id u6sm21636839pgr.3.2021.09.28.06.36.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Sep 2021 06:36:49 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Sep 2021 21:36:37 +0800 Message-Id: <1632836198-23044-3-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1632836198-23044-1-git-send-email-lance.lmwang@gmail.com> References: <1632836198-23044-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 3/4] avutil/detection_bbox: simplify code for better readability 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: XFpom8/Fhf6n From: Limin Wang Signed-off-by: Limin Wang --- libavutil/detection_bbox.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c index 8bfdff7..3de66ce 100644 --- a/libavutil/detection_bbox.c +++ b/libavutil/detection_bbox.c @@ -23,27 +23,29 @@ AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_s size_t size; struct BBoxContext { AVDetectionBBoxHeader header; - AVDetectionBBox boxes[1]; - } *ret; + AVDetectionBBox boxes; + }; const size_t bboxes_offset = offsetof(struct BBoxContext, boxes); + const size_t bbox_size = sizeof(AVDetectionBBox); + AVDetectionBBoxHeader *header; - size = sizeof(*ret); - if (nb_bboxes - 1 > (SIZE_MAX - size) / sizeof(*ret->boxes)) + size = bboxes_offset; + if (nb_bboxes > (SIZE_MAX - size) / bbox_size) return NULL; - size += sizeof(*ret->boxes) * (nb_bboxes - 1); + size += bbox_size * nb_bboxes; - ret = av_mallocz(size); - if (!ret) + header = av_mallocz(size); + if (!header) return NULL; - ret->header.nb_bboxes = nb_bboxes; - ret->header.bbox_size = sizeof(*ret->boxes); - ret->header.bboxes_offset = bboxes_offset; + header->nb_bboxes = nb_bboxes; + header->bbox_size = bbox_size; + header->bboxes_offset = bboxes_offset; if (out_size) *out_size = size; - return &ret->header; + return header; } AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes) From patchwork Tue Sep 28 13:36:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 30630 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp5210798iob; Tue, 28 Sep 2021 06:37:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMlJJKxLy1zsUdHO3Sk1xMNJvMnbVkjmj+RlXyAGHsV7XovZxm7qtcKf7v5oZLGbyahoZj X-Received: by 2002:a05:6402:16d9:: with SMTP id r25mr7579383edx.80.1632836250276; Tue, 28 Sep 2021 06:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632836250; cv=none; d=google.com; s=arc-20160816; b=AA8Rgl8H9sRvptBXjNxnDkxkKd2x7I/7jiN7AFzAsA5vIKUp0ml8q6m7VxV7HyL/De giB/tbXFHj+OB+ztsV0yJtwrgqKhfYBMbBQ0sLS0NszrrEVpia859lTHYFbRzv2NqDpP gWMlWsXyWtukz1VnYWryDI872KayTVCqrp64ewpw/HZYb2OuQXGsYODo1nUPtTTxmf2e fiqmtfr0Zf/zFAKSerivrOoUWAPvA/qqvC/gt+S701tHjC6OHgIvzNlMlDUrzjqpRCYe Xobq4SG5Cj4CFV+8N/BiDpCzvFMvutR7YOhAAT6mHBKGP9TFJCRACo54DPAb3HqEFxbU dYUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=w/UyrMzwjzItMBnTng3ytzDtnw+R4jy3E4rKrwB7mi0=; b=VKQeqglxPxxHv6ewDi+linRxr3iXVBKYJPb/kYTy23SDaYsk33np19Cx5xVsp8SnYC 1GJsNVFmsD9h6hWovTm9p4rrqMywhsy8sZvYpaccdSWbnzOToLDnWw5PCe+IaHAVIKs0 fqellho0DhZPGiFhy8zvLQsMuIFn6dZcwL5MYRlraqBn1TetH6YnrTRJ5cBGuuvcfOpG NwSNSjd07dR2fgK9VI38MIxef4/7jcPqYzSRCwjUfd/sEnNFScpoT+9f1dufuDje1ppL +hLlM1wDaA3Epo8qHuIEVIRz11zu0HUv2Om+LvTsmtBHB9AJeuXWc/A4n9CKoRsXBPKH cDeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ALUVf9kD; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e1si1701212ejl.635.2021.09.28.06.37.29; Tue, 28 Sep 2021 06:37:30 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ALUVf9kD; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 511D56899BB; Tue, 28 Sep 2021 16:37:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C87B9689A15 for ; Tue, 28 Sep 2021 16:36:52 +0300 (EEST) Received: by mail-pj1-f42.google.com with SMTP id om12-20020a17090b3a8c00b0019eff43daf5so2831438pjb.4 for ; Tue, 28 Sep 2021 06:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dTg01zsANqSSc5HXq+x6U86+CAcb0hFHHm0iGIE1nhw=; b=ALUVf9kDdTPf+83bhHNQULRyItm4eOHaFpLzsLnNmfGO4g8jTZZKi7L13X9Los+7al Yk4M3h+0SBIbbh/FlccwJVJ904RZYWiVlToRG9rIXB/knM1wEoyr0WPBMReS4yAcBhIl EQnofGH26BdhVYVtoFIxWVB5Htlsjr22N02pU+vIj72teRcBoFBiwHWKI+8oHChyL6pE BKtcJFXZfHJ4bkLn8u6fmHPx3HGAsdgz4jTvcQgXBZjg//qVFO5fcgajl25g3bOY4NFW XCvHoyOGWgXAryJIApkuDBgErO6FrLV5/tof8A4559N/xXWzLlLxWdmjfgy6GC4nyvdw Tthg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dTg01zsANqSSc5HXq+x6U86+CAcb0hFHHm0iGIE1nhw=; b=R3+hnOnyL3aYbDbiqtodqT+FyHmzeTQ2rtNps+YVy2U0d9L3bWqXrFcabbtUr0HQcf wWpiuraSvKZ7+4M5PpDZXnqO0g4/wfhS2yRgjb/NVmj3pHLV7lBHhZNjmOeNJOE8vwec YKZqJ4WQPlPdtbXiJZspfaIG76PoBa7tfZEMkuqHuZ/ewXKB+E71Xd1TbDDa3Umt4dfI wCF0cpCvpXJD69fYQ8NC9Ils6ILGLiFOigMfZHxMpAtxM0jKjg2LDmZK1cwftnVK2ufb Fai9qiLS2FuLboV+7otA0mLDI9WOxAMQNch6VzYZXUGySH0mq+HW+QL+mQAmtQa6Ke2q wA2w== X-Gm-Message-State: AOAM5323obVgnTVeE4rkxWWVbQsIXFJ8FZ0Wxs99CKRx4EmJAS4kwwZc KZTeEFTUY2ua5SgPi1WNQs9StFxPaSk= X-Received: by 2002:a17:90a:ad47:: with SMTP id w7mr22508pjv.110.1632836211073; Tue, 28 Sep 2021 06:36:51 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id u6sm21636839pgr.3.2021.09.28.06.36.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Sep 2021 06:36:50 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Sep 2021 21:36:38 +0800 Message-Id: <1632836198-23044-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1632836198-23044-1-git-send-email-lance.lmwang@gmail.com> References: <1632836198-23044-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/hevcdec: set the film grain property if present 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: QGb8OA/sHDIP From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevcdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 57a6175..b4edb3b 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -385,6 +385,9 @@ static int export_stream_params_from_sei(HEVCContext *s) avctx->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics; } + if (s->sei.film_grain_characteristics.present) + avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN; + return 0; }