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 98EEF435AA for ; Tue, 17 Jan 2023 11:19:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1483668BDD5; Tue, 17 Jan 2023 13:18:58 +0200 (EET) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C006868BD53 for ; Tue, 17 Jan 2023 13:18:51 +0200 (EET) Received: by mail-ej1-f49.google.com with SMTP id hw16so62693917ejc.10 for ; Tue, 17 Jan 2023 03:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kzVEdR+NQIXEdqfRuH5OFQ8D90IAzMPencqrIgmT07g=; b=gWQbDHqF7nQgQlC+3LFDZtyh/tCCzbrQ2YV0xQ89TDBmDPo0O4DUxfhrurSmPRrLC+ Yx+gyA8S4bU/KElZy2GofnBzziehlYTvoMOLP+J2Mf8442CRHDDao8zBNIUYHF6Z0Ibz bQPvd9BwMfkcDLB9Jx7sqRd2yA185l88oNrtsepBhWonSwUB4JLK2JWwYpGh5xl2NINm 0plPtZANccLkCRk14bh1RfeHpjiPjBViMwK3ZdHSYkEhgui4e4BvclBfQL4nH7h4kRWN 8dyM7sRbaHLTLy91aCbTzhujyYLFJ4M3ymUDtSpwtUAlVMMdUonGiYGx2IgeO8i2pIB+ S4Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kzVEdR+NQIXEdqfRuH5OFQ8D90IAzMPencqrIgmT07g=; b=jnInBlo06ayZa1R+QAeFlD5slxHn1RiLhk0W4KAEnNE8pm/yTO88qrNuBY28+Nb/Nw pj2nlT+vKBFFDyxuB9wK2MGvJxfnAKqvdUGihfrp2qO7Nm/Ps9a193LHAxwgibtVbntD KNiJ/RN+mrYGul5vfTCaJbrUxY76LvA2WIcH80lkLIjNC61fhZ4hYSW9eOfvtrnO2xbS sbA7I7rOQi5WD7pm3MWb/PgMsQKQJOucMvBkewFQ5EwK8Y8Sl2vizLxELMeQ2DbKB5tV RvG9zcXJ7XcOmZMicSTSTcx32oexNRt4LltJ+RcTowNQUobbYc5h90b795lvEsQP2q77 IVjQ== X-Gm-Message-State: AFqh2kp8mYC5smTX9Zqr2/WSzMaJVSBHRQI5ds9PHihtt344zoT1ZA1X svH3uQ0+JOdl+kZpwMp3ersX0+/rb3g= X-Google-Smtp-Source: AMrXdXu6svDEzwvV0eu8dRyUT5X14vNIkR3nUs9fslzsznk1o+HL9CVP0ATIZZREYnaq9RxBdqpI8w== X-Received: by 2002:a17:907:c58c:b0:837:3ed3:9c2b with SMTP id tr12-20020a170907c58c00b008373ed39c2bmr2655188ejc.5.1673954330709; Tue, 17 Jan 2023 03:18:50 -0800 (PST) Received: from mitsuki.. (ip-78-45-48-213.bb.vodafone.cz. [78.45.48.213]) by smtp.gmail.com with ESMTPSA id um41-20020a170907cb2900b0086c4fbb8507sm4424173ejc.225.2023.01.17.03.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 03:18:50 -0800 (PST) From: David Rosca To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Jan 2023 12:17:58 +0100 Message-Id: <20230117111756.120551-1-nowrep@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] 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: David Rosca 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: v3: pic_order_cnt steps by 2 --- libavcodec/vaapi_encode_h264.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index f15bcc6..de0951f 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -361,8 +361,10 @@ 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->log2_max_pic_order_cnt_lsb_minus4 = 4; + sps->pic_order_cnt_type = ctx->max_b_depth ? 0 : 2; + if (sps->pic_order_cnt_type == 0) { + sps->log2_max_pic_order_cnt_lsb_minus4 = 4; + } sps->max_num_ref_frames = priv->dpb_frames; @@ -643,6 +645,10 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, } } hpic->pic_order_cnt = pic->display_order - hpic->last_idr_frame; + if (priv->raw_sps.pic_order_cnt_type == 2) { + hpic->pic_order_cnt *= 2; + } + hpic->dpb_delay = pic->display_order - pic->encode_order + ctx->max_b_depth; hpic->cpb_delay = pic->encode_order - hpic->last_idr_frame; -- 2.39.0 _______________________________________________ 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".