From: Jammy Huang <jammy_huang@aspeedtech.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: "eajames@linux.ibm.com" <eajames@linux.ibm.com>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"joel@jms.id.au" <joel@jms.id.au>,
"andrew@aj.id.au" <andrew@aj.id.au>,
"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"laurent.pinchart@ideasonboard.com"
<laurent.pinchart@ideasonboard.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 7/9] media: aspeed: Support aspeed mode to reduce compressed data
Date: Tue, 16 Nov 2021 12:15:25 +0800 [thread overview]
Message-ID: <67e3be3a-7e18-115b-18b7-b3d5419e0992@aspeedtech.com> (raw)
In-Reply-To: <YZIYIsURV0Gv1bc6@paasikivi.fi.intel.com>
Hi Sakari,
OK, I will add a patch which uses data in device table to tell the
differences between
SoC to the series. Thanks for your advice.
On 2021/11/15 下午 04:19, Sakari Ailus wrote:
> Hi Jammy,
>
> Thanks for the patch. A few comments below...
>
> On Mon, Nov 15, 2021 at 03:44:35PM +0800, Jammy Huang wrote:
>> @@ -969,35 +1045,70 @@ static void aspeed_video_set_resolution(struct aspeed_video *video)
>>
>> static void aspeed_video_update_regs(struct aspeed_video *video)
>> {
>> - u32 comp_ctrl = VE_COMP_CTRL_RSVD |
>> - FIELD_PREP(VE_COMP_CTRL_DCT_LUM, video->jpeg_quality) |
>> - FIELD_PREP(VE_COMP_CTRL_DCT_CHR, video->jpeg_quality | 0x10);
>> + u8 jpeg_hq_quality = clamp((int)video->jpeg_hq_quality - 1, 0,
>> + ASPEED_VIDEO_JPEG_NUM_QUALITIES - 1);
>> + u32 comp_ctrl = FIELD_PREP(VE_COMP_CTRL_DCT_LUM, video->jpeg_quality) |
>> + FIELD_PREP(VE_COMP_CTRL_DCT_CHR, video->jpeg_quality | 0x10) |
>> + FIELD_PREP(VE_COMP_CTRL_EN_HQ, video->hq_mode) |
>> + FIELD_PREP(VE_COMP_CTRL_HQ_DCT_LUM, jpeg_hq_quality) |
>> + FIELD_PREP(VE_COMP_CTRL_HQ_DCT_CHR, jpeg_hq_quality |
>> + 0x10);
>> u32 ctrl = 0;
>> - u32 seq_ctrl = VE_SEQ_CTRL_JPEG_MODE;
>> + u32 seq_ctrl = 0;
>>
>> - v4l2_dbg(1, debug, &video->v4l2_dev, "framerate(%d)\n",
>> - video->frame_rate);
>> - v4l2_dbg(1, debug, &video->v4l2_dev, "subsample(%s)\n",
>> + v4l2_dbg(1, debug, &video->v4l2_dev, "framerate(%d)\n", video->frame_rate);
>> + v4l2_dbg(1, debug, &video->v4l2_dev, "jpeg format(%s) subsample(%s)\n",
>> + format_str[video->format],
>> video->yuv420 ? "420" : "444");
>> - v4l2_dbg(1, debug, &video->v4l2_dev, "compression quality(%d)\n",
>> - video->jpeg_quality);
>> + v4l2_dbg(1, debug, &video->v4l2_dev, "compression quality(%d) hq(%s) hq_quality(%d)\n",
>> + video->jpeg_quality, video->hq_mode ? "on" : "off",
>> + video->jpeg_hq_quality);
>> + v4l2_dbg(1, debug, &video->v4l2_dev, "compression mode(%s)\n",
>> + compress_mode_str[video->compression_mode]);
>> +
>> + if (video->format == VIDEO_FMT_ASPEED)
>> + aspeed_video_update(video, VE_BCD_CTRL, 0, VE_BCD_CTRL_EN_BCD);
>> + else
>> + aspeed_video_update(video, VE_BCD_CTRL, VE_BCD_CTRL_EN_BCD, 0);
>>
>> if (video->frame_rate)
>> ctrl |= FIELD_PREP(VE_CTRL_FRC, video->frame_rate);
>>
>> + if (video->format == VIDEO_FMT_STANDARD) {
>> + comp_ctrl &= ~FIELD_PREP(VE_COMP_CTRL_EN_HQ, video->hq_mode);
>> + seq_ctrl |= VE_SEQ_CTRL_JPEG_MODE;
>> + }
>> +
>> if (video->yuv420)
>> seq_ctrl |= VE_SEQ_CTRL_YUV420;
>>
>> if (video->jpeg.virt)
>> aspeed_video_update_jpeg_table(video->jpeg.virt, video->yuv420);
>>
>> +#ifdef CONFIG_MACH_ASPEED_G4
> This would be better done based on the device recognised, not the selected
> compile target. The same goes for the rest of the conditional pre-processor
> bits.
>
>> + switch (video->compression_mode) {
>> + case 0: //DCT only
>> + comp_ctrl |= VE_COMP_CTRL_VQ_DCT_ONLY;
>> + break;
>> + case 1: //DCT VQ mix 2-color
>> + comp_ctrl &= ~(VE_COMP_CTRL_VQ_4COLOR | VE_COMP_CTRL_VQ_DCT_ONLY);
>> + break;
>> + case 2: //DCT VQ mix 4-color
>> + comp_ctrl |= VE_COMP_CTRL_VQ_4COLOR;
>> + break;
>> + }
>> +#endif
>> +
--
Best Regards
Jammy
next prev parent reply other threads:[~2021-11-16 4:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 7:44 [PATCH v4 0/9] add aspeed-jpeg support for aspeed-video Jammy Huang
2021-11-15 7:44 ` [PATCH v4 1/9] media: aspeed: move err-handling together to the bottom Jammy Huang
2021-11-15 7:44 ` [PATCH v4 2/9] media: aspeed: use v4l2_info/v4l2_warn/v4l2_dbg for log Jammy Huang
2021-11-15 7:44 ` [PATCH v4 3/9] media: aspeed: add more debug log messages Jammy Huang
2021-11-15 7:44 ` [PATCH v4 4/9] media: aspeed: refactor to gather format/compress settings Jammy Huang
2021-11-15 7:44 ` [PATCH v4 5/9] media: v4l: Add definition for the Aspeed JPEG format Jammy Huang
2021-11-15 7:44 ` [PATCH v4 6/9] media: v4l2-ctrls: Reserve controls for ASPEED Jammy Huang
2021-11-15 7:44 ` [PATCH v4 7/9] media: aspeed: Support aspeed mode to reduce compressed data Jammy Huang
2021-11-15 8:19 ` Sakari Ailus
2021-11-16 4:15 ` Jammy Huang [this message]
2021-11-15 7:44 ` [PATCH v4 8/9] media: aspeed: add comments and macro Jammy Huang
2021-11-15 7:44 ` [PATCH v4 9/9] media: aspeed: Extend debug message Jammy Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67e3be3a-7e18-115b-18b7-b3d5419e0992@aspeedtech.com \
--to=jammy_huang@aspeedtech.com \
--cc=andrew@aj.id.au \
--cc=eajames@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=joel@jms.id.au \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).