Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2348821rdh; Sun, 29 Oct 2023 11:47:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGj7ZfYZzesCVa4NT1E9VjxQbAlJIRftB5r0vrveqgy/JW3C1DB9YmRQXySRfFXNswylinr X-Received: by 2002:a05:6870:b14:b0:1e9:e20b:1cbf with SMTP id lh20-20020a0568700b1400b001e9e20b1cbfmr11735786oab.55.1698605230075; Sun, 29 Oct 2023 11:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698605230; cv=none; d=google.com; s=arc-20160816; b=rszYhvLgAvgF5Uftg+YyVfYoSqQbkMHoz3xYrY6vkk6a4V972XabX8YMBCuj1hJtnu SXWOLWy44wZ9GDy61o02PEqbR1OsjnbBZXw+rDdD1ox2rHj4OVPeizBbbRVpcUeQCZ7k lfMU3nNErCnIB1MTIhgePxG+/r90Fg6gB6Wz5xHHGksrIXSRKslCY+IvSEhR08wXrNci 5QjCNRX7QYK2P9yG5GGfAeXvaIjwRD7GrVQPSDq7D1CjtY/Q3p5DVpuViYf+3VPVjDaF Z0CT1zr5oEqd69FmOJG5FNlCYeZ8mdrpYYAKvwJCOnhK96Kyh5JgUy+obstMvyy+gzBP tI/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=as9AeGM+ifzsnqtyzSQemv/snnZnIqMpieeTV1wu21Q=; fh=mpVSHlz6QLTMQJyYfdyLOAes1Kk5kund3qIBSdmv/MI=; b=idSMkOw8BKDSuoD5DRCAIAgv3a8aYMWZsRSwj69KZep3Jxx+cdd5e+eP2WXSmS3OQU oK+XiX1tOFle9DIbZqAcvK2vGgsn4+2jJryod4K6VTObBkkofSn6E6+9z2Hg9gz9rV8F HwlXZXKu9tcIlhGIM98w6sOVZbVfo+0lcGwOql1+lio6oY5NyePyUlZrrATKHC+oemlE /aCEFsNq9R36unwyvbivq8nrqh59Hw6i/eDZhnCaTUzGORIIbg7jq0ZX8v5jdI9/H+hQ dCrajWQ6fBhcTsgIaE74hfzn0UZ3R1DypjjLuWkNcjVWo5XM2e9N3tBmoxtmUT79Esm0 fNRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b=RSmKmIdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h18-20020a63f912000000b005af4cc9e22fsi3840552pgi.840.2023.10.29.11.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 11:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b=RSmKmIdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4A9A480781DC; Sun, 29 Oct 2023 11:46:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbjJ2Spy (ORCPT + 99 others); Sun, 29 Oct 2023 14:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230380AbjJ2Spw (ORCPT ); Sun, 29 Oct 2023 14:45:52 -0400 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BD72F4; Sun, 29 Oct 2023 11:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1698605142; bh=as9AeGM+ifzsnqtyzSQemv/snnZnIqMpieeTV1wu21Q=; b=RSmKmIdAgYUVUMoqCCVeFHEavSI11L44Ut2u7mb7J5MrDWPnRYEHjkpSVm25MVAUv34HwnIdX mmOFhHpU9aNGtPggPpIHNJpQvqOTKJQp1034JFLAUslLBc0pwHsK4h6XzKFIzOfFffLFV4qmx8W WIELfUHk1lI6ZY+3i3Gjn2c+4N/8XecQalhXgQRpLCXx4yDR3F41gSOHH2H8kZaoY+3LzQTetE+ ummH5Q43VMFFH/sazb3Uw0jdiBNw3V8b5f6hl79JxtMEG+XuNrXMr/8cggOjZGXCC6cAp0+HMMQ BxJaQLbPY+RxTsihF1qXzrS3NXJMBd5A5rLWVdA5Dr2A== From: Jonas Karlman To: Ezequiel Garcia , Mauro Carvalho Chehab , "Greg Kroah-Hartman" Cc: Alex Bee , Nicolas Dufresne , Benjamin Gaignard , Sebastian Fricke , Christopher Obbard , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Jonas Karlman Subject: [PATCH v3 04/10] media: rkvdec: h264: Don't hardcode SPS/PPS parameters Date: Sun, 29 Oct 2023 18:34:11 +0000 Message-ID: <20231029183427.1781554-5-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029183427.1781554-1-jonas@kwiboo.se> References: <20231029183427.1781554-1-jonas@kwiboo.se> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Report-Abuse-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Complaints-To: abuse@forwardemail.net X-ForwardEmail-Version: 0.4.40 X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 X-ForwardEmail-ID: 653ea5c98fe0ffca230b0f3c X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 29 Oct 2023 11:46:07 -0700 (PDT) From: Alex Bee Some SPS/PPS parameters are currently hardcoded in the driver even though they exist in the stable uapi controls. Use values from SPS/PPS controls instead of hardcoding them. Signed-off-by: Alex Bee [jonas@kwiboo.se: constraint_set_flags condition, commit message] Signed-off-by: Jonas Karlman --- v3: - New patch drivers/staging/media/rkvdec/rkvdec-h264.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c index 7a1e76d423df..8bce8902b8dd 100644 --- a/drivers/staging/media/rkvdec/rkvdec-h264.c +++ b/drivers/staging/media/rkvdec/rkvdec-h264.c @@ -655,13 +655,14 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, #define WRITE_PPS(value, field) set_ps_field(hw_ps->info, field, value) /* write sps */ - WRITE_PPS(0xf, SEQ_PARAMETER_SET_ID); - WRITE_PPS(0xff, PROFILE_IDC); - WRITE_PPS(1, CONSTRAINT_SET3_FLAG); + WRITE_PPS(sps->seq_parameter_set_id, SEQ_PARAMETER_SET_ID); + WRITE_PPS(sps->profile_idc, PROFILE_IDC); + WRITE_PPS(!!(sps->constraint_set_flags & (1 << 3)), CONSTRAINT_SET3_FLAG); WRITE_PPS(sps->chroma_format_idc, CHROMA_FORMAT_IDC); WRITE_PPS(sps->bit_depth_luma_minus8, BIT_DEPTH_LUMA); WRITE_PPS(sps->bit_depth_chroma_minus8, BIT_DEPTH_CHROMA); - WRITE_PPS(0, QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG); + WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS), + QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG); WRITE_PPS(sps->log2_max_frame_num_minus4, LOG2_MAX_FRAME_NUM_MINUS4); WRITE_PPS(sps->max_num_ref_frames, MAX_NUM_REF_FRAMES); WRITE_PPS(sps->pic_order_cnt_type, PIC_ORDER_CNT_TYPE); @@ -688,8 +689,8 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, DIRECT_8X8_INFERENCE_FLAG); /* write pps */ - WRITE_PPS(0xff, PIC_PARAMETER_SET_ID); - WRITE_PPS(0x1f, PPS_SEQ_PARAMETER_SET_ID); + WRITE_PPS(pps->pic_parameter_set_id, PIC_PARAMETER_SET_ID); + WRITE_PPS(pps->seq_parameter_set_id, PPS_SEQ_PARAMETER_SET_ID); WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE), ENTROPY_CODING_MODE_FLAG); WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT), -- 2.42.0