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 A47C144BDC for ; Mon, 9 Jan 2023 07:37:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 28B2568BBD2; Mon, 9 Jan 2023 09:37:51 +0200 (EET) Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3592E68BBA3 for ; Mon, 9 Jan 2023 09:37:44 +0200 (EET) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-4a0d6cb12c5so102707037b3.7 for ; Sun, 08 Jan 2023 23:37:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TFDrCDuiCKZI7KdQizGA3VDWn0i0u6CFOw07CW0IpuI=; b=cKwdNhIwhrj2BOidJ8JpxGsNIKrEjlgBF1slkcZLVYeIhcG3vOX4SShAFXkknvTc8R hVe2jSLMeetWR4TCx44tNFiRATeFWegrgfQNX+2uDBR8LvS7Xqpy9avRZnbuMiMA/fD4 K29DOZZ711jWnOsUniz1xRJyvuTUbwvcM0CPqux27tnokWHE8N07w9XTM7Pnf+f5O8fs hH9BCwMw7zj5qiFw0EIIrsTJShu+h2i+kKJCLFwFBOYP5d8cOBMj23a7VtiAKXIa0f+m RIKElyS60Tjs1jmxpcKnYfWnvjfm82A/+myRe7g621ZUX8OLTIG4NzIIkSy7P5BdVxTM s+zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TFDrCDuiCKZI7KdQizGA3VDWn0i0u6CFOw07CW0IpuI=; b=0o0Rl5Ia5gB5NhSmEBrTHebovCZ5RJba1Tc8RyD1aJJ0FQ/8NbaZr4bQubtUlDYA5K rUKwV/iEd2vO3J5okDqmMPUy9uY7EbB6R/fEH0mkhhzxU+C6AUXOdlpLoAu1vDZyRy+H UKy5bAGl3ICoSUf7QDagrmJQb4iMyNB1MLr2HlHky8RE6jjZK3WDpiF40edvlrbr7Gea 0E9oZyAPLPozB6Afrgz4GF1Vh2/qKgXkeQ55oIomu+dmHRjLxz0nwVOvkiBzSUyMcbcO M0nKghqy0pgXOn94h56/d5CBuXLVqPg0JP0jQ7Hfsb/z1Jq7yLwGDr6s+mUgfQkbiHRb HN9A== X-Gm-Message-State: AFqh2kq8cO4seXO3u0fFMrA2sbG/estZVUNnaTjXuF8ncNYepDKeHCwu tJr2KkYYwys7OURkaGlBTyMIL4SF9CPyVetjHdM= X-Google-Smtp-Source: AMrXdXsBZLAfWeyQhm4WvpBDh4E7Kg37aMq4zRR0EI8ltDcpUOR8+flWCuy635IRR0Zw3qXAKG6KwzpKipWEQ9nKFOE= X-Received: by 2002:a81:4c07:0:b0:3e3:866c:a51b with SMTP id z7-20020a814c07000000b003e3866ca51bmr6197068ywa.439.1673249862561; Sun, 08 Jan 2023 23:37:42 -0800 (PST) MIME-Version: 1.0 References: <20221229212024.422950-1-nowrep@gmail.com> <4b82107f2055a9a784fbf97fe8838ce9349534b7.camel@intel.com> In-Reply-To: <4b82107f2055a9a784fbf97fe8838ce9349534b7.camel@intel.com> From: David Rosca Date: Mon, 9 Jan 2023 08:37:31 +0100 Message-ID: To: "Xiang, Haihao" Subject: Re: [FFmpeg-devel] [PATCH] vaapi_encode_h264: Only set pic_order_cnt_type to 0 with B-frames 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: "ffmpeg-devel@ffmpeg.org" 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 Mon, Jan 9, 2023 at 3:22 AM Xiang, Haihao wrote: > > On Do, 2022-12-29 at 22:20 +0100, David Rosca wrote: > > --- > > libavcodec/vaapi_encode_h264.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c > > index dd17be2..d6926c4 100644 > > --- a/libavcodec/vaapi_encode_h264.c > > +++ b/libavcodec/vaapi_encode_h264.c > > @@ -350,7 +350,7 @@ static int > > vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx) > > sps->chroma_format_idc = 1; > > > > sps->log2_max_frame_num_minus4 = 4; > > - sps->pic_order_cnt_type = 0; > > + sps->pic_order_cnt_type = ctx->max_b_depth ? 0 : 2; > > > pic_order_cnt_type (0) should work for ctx->max_b_depth == 0. If 2 is preferred > for your vaapi driver, it would be better to query the capability from the > driver, like as what commit 9f02e033875185409c861846f209b04a3be339d2 did. It's not about an encoder, but rather about decoder. Some decoders (namely the Snapdragon HW decoder) will buffer frames when pic_order_cnt_type == 0 (in case the frames will be reordered?) which results in undesired increased latency. Setting pic_order_cnt_type to 2 will fix this problem, and it is also what libx264 does [0]. Regards, David [0] https://code.videolan.org/videolan/x264/-/blob/master/encoder/set.c#L173 > > Thanks > Haihao > > > sps->log2_max_pic_order_cnt_lsb_minus4 = 4; > > > > sps->max_num_ref_frames = priv->dpb_frames; _______________________________________________ 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".