From patchwork Fri Aug 16 03:05:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 14543 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id BAC8E448852 for ; Fri, 16 Aug 2019 06:13:59 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A572268AD3C; Fri, 16 Aug 2019 06:13:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4B47B68AD23 for ; Fri, 16 Aug 2019 06:13:53 +0300 (EEST) Received: by mail-wm1-f67.google.com with SMTP id p77so2241007wme.0 for ; Thu, 15 Aug 2019 20:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q3lYYIEEyUH4Pu2kNS+0M0FtfOqVUGa57WAMGIhsh74=; b=POBQ5HSWDju305wE6z0VMeqniayWciIMYMTCv0+Qckvciv20xdvg1sPX0wn4QiDtHU vQ70TO6ZzMX2b/vn1/Krms6pQRBUs6a/96YQuKzgqKZOjFB63wtr/m5D3YRqMZe7PEjx Qsi9/BHNZd7m0PXqJFNDYF2Fo1tIy0hVY9rbAJZ1CGqg7oFWtOOvTplp5Aj/W54A1mM9 ozzsdb9/77YNvudQXzksyLvnw6wrw//jiezorYkRMj3fhTjKfenoxY/ajIGCtPztUb/q mVArkwh3JHEUv7wx85yBzZCgBEoZdt5ZP++00m2HeWXnu9H+7HtWKuOQ/fCwDc5ca9pn 3PKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q3lYYIEEyUH4Pu2kNS+0M0FtfOqVUGa57WAMGIhsh74=; b=RI+ydWCuHwrdFZJjp8HYWVByQaPvAweCaKVxxB+Cf6MR+EzyYKHXZR/lLaUv67Y7bC P4hpSVunltOBocsC93QX9iU/Vr+kgq97sbR+QN278vwNEJrjsy4llxFtXzmQH+uB+KEf YuXrxrEOXMesik5TBlNZufrHyMvv2ThvadOoV0rZJPtdZ6KqkwC9f4MK5R0yZVUPokTb VrIuWeEGnYrrcU3JnWnU8PBCNJiZluajBRcUYU5gUZZ+6pEDG+m9bV4/0H7v1eQx/iHG G4rNrngZYC4nsZ57V7++4HfUWi4Bj8orCPVcDkSG7WYUYWpsBvP/6jtCAUTiHLAMZDmS RqWQ== X-Gm-Message-State: APjAAAWzCxpOWflfpM5qQ6cHtlbiejBRYLieajP06kfNjn+fQrCK1xit A1s9emYJow0Jav3A4/Eww+dQC9+F X-Google-Smtp-Source: APXvYqxtevz1n7N249v1zBlJaQTF4KFh8Qevy9ZdisI19kU/hUsalAxfqgZgueFASy7unaJqwkk+rA== X-Received: by 2002:a1c:5a56:: with SMTP id o83mr4836280wmb.103.1565925232665; Thu, 15 Aug 2019 20:13:52 -0700 (PDT) Received: from localhost.localdomain (ipbcc08b69.dynamic.kabel-deutschland.de. [188.192.139.105]) by smtp.gmail.com with ESMTPSA id x20sm8501603wrg.10.2019.08.15.20.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2019 20:13:52 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Aug 2019 05:05:30 +0200 Message-Id: <20190816030531.4775-10-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816030531.4775-1-andreas.rheinhardt@gmail.com> References: <20190816030531.4775-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/11] avcodec/h264_parser: Don't keep full DSP Context X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" We only need the function to search for start codes from it. Signed-off-by: Andreas Rheinhardt --- libavcodec/h264_parser.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 604cddada5..68eb5939db 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -50,10 +50,10 @@ typedef struct H264ParseContext { ParseContext pc; H264ParamSets ps; - H264DSPContext h264dsp; H264POCContext poc; H264SEIContext sei; H2645RBSP rbsp; + int (*startcode_find_candidate)(const uint8_t *buf, int size); int is_avc; int nal_length_size; int got_first; @@ -97,7 +97,7 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, } if (state == 7) { - i += p->h264dsp.startcode_find_candidate(buf + i, next_avc - i); + i += p->startcode_find_candidate(buf + i, next_avc - i); if (i < next_avc) state = 2; } else if (state <= 2) { @@ -705,10 +705,13 @@ static void h264_close(AVCodecParserContext *s) static av_cold int init(AVCodecParserContext *s) { H264ParseContext *p = s->priv_data; + H264DSPContext h264dsp; + + ff_h264dsp_init(&h264dsp, 8, 1); + p->startcode_find_candidate = h264dsp.startcode_find_candidate; p->reference_dts = AV_NOPTS_VALUE; p->last_frame_num = INT_MAX; - ff_h264dsp_init(&p->h264dsp, 8, 1); return 0; }