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 9A56943870 for ; Fri, 1 Jul 2022 11:31:17 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5496F68B800; Fri, 1 Jul 2022 14:31:14 +0300 (EEST) Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D3CB068B7DC for ; Fri, 1 Jul 2022 14:31:07 +0300 (EEST) Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-3178acf2a92so20601647b3.6 for ; Fri, 01 Jul 2022 04:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YuU9JTf029bH17sQ0PVbXv4JLrjHknBNXljShV/zzEo=; b=o/Pt2eM0M4vR3U9fBD/smMoxEzbqzmj5phYZwqV6pmld7wIkM6cJ4H2ukoDKt5EtRn 8gkNSQ18znnTZVPlvqwL8dJql17CUP3v8ytWo9qyuZKmfTV8P0PVa2hAY8/POQHMUqAm bc+njB+E+FnBWogB/jzR3Yu+kOGNK3PMwwL1sCUW+fdzbqvfKU3RGAdBNLpyF49xqap+ 9BwWicfp89qVzHZoIese3vSOhZiJT11b2iRi4M4h6hmi8s5r0ndfY2CKJC8lZtdp7Lvz YV/LTiyXa9mmXC1/LoAxZSm3sj7IlWp0PSSnT/gWi3KZQvfa6/6MFZgU0oD8YBkMWWru MClQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YuU9JTf029bH17sQ0PVbXv4JLrjHknBNXljShV/zzEo=; b=FU4nzfneekB7CrlX1IjzcfTJpCD6NmX3Dn4smBiU2hpowSz004P0M4T5oBHrVArwmS BchYTHgceMe4Sdvmmp10FcDydn5DAoXech951nAvJqqrcOyXKx3I9mkKpViY3DFN4cOX BdmNY7XOcOgefNTvw+FxTaUlRPQeVOCwu9QOBjkcOYIP6jPNTrqVYbkBAOrPnTatV5yf 97Sak5wMewiY+4QmkgPRCrYC62SvYIpP1/RMFSUa571dD0hozsmHI88Zv+DR8toOujQz fFu2c/eYbYozloR2gZyelRrFLyC+kIABh2YRfjyUbvyz0tcZKzNQ369UYox5mKdEiYkI +rEg== X-Gm-Message-State: AJIora9xtCubHUoAPCYbUbm1VBhnFvfOSTP9UOhwI1g7/J/okr8+tHqS H2xoo5WnNHmvvVDuWuDeqSpyTHn62mLsi2nusfeMrtyU8p0= X-Google-Smtp-Source: AGRyM1swXbxB7O1adVJFMUqh+VUfaGJhClGQazWSWLOujeU/cVawKY/KXF+1gqff3+esn1bmfhQ1HlqwgwWK5JNeIwM= X-Received: by 2002:a0d:e841:0:b0:317:9fea:a18b with SMTP id r62-20020a0de841000000b003179feaa18bmr16363066ywe.302.1656675066216; Fri, 01 Jul 2022 04:31:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Paul B Mahol Date: Fri, 1 Jul 2022 13:33:51 +0200 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH 17/18] avcodec/pthread_slice: Reuse buffer if possible 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: Andreas Rheinhardt 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 Fri, Jul 1, 2022 at 12:32 AM Andreas Rheinhardt < andreas.rheinhardt@outlook.com> wrote: > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/pthread_slice.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c > index 756cc59dbf..a4d31c6f4d 100644 > --- a/libavcodec/pthread_slice.c > +++ b/libavcodec/pthread_slice.c > @@ -242,9 +242,11 @@ int ff_slice_thread_allocz_entries(AVCodecContext > *avctx, int count) > if (avctx->active_thread_type & FF_THREAD_SLICE) { > SliceThreadContext *p = avctx->internal->thread_ctx; > > - if (p->entries) { > - av_freep(&p->entries); > + if (p->entries_count == count) { > + memset(p->entries, 0, p->entries_count * sizeof(*p->entries)); > + return 0; > } > + av_freep(&p->entries); > > p->entries = av_calloc(count, sizeof(*p->entries)); > if (!p->entries) { > -- > 2.34.1 > > LGTM > _______________________________________________ > 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".