i.MX8M Mini VPU: Changing H.264 Profile

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8M Mini VPU: Changing H.264 Profile

3,386 Views
koilarulraj
Contributor II

Hi,

In the specs for the i.MX8M Mini VPU, it states that the encoder supports H.264 Base Profile, Main Profile, and High Profile. I would like set the VPU encoder profile support by default to High Profile.


I added following line in the kernel source file, drivers/mxc/vpu-encoder-b0/vpu_encoder_b0.c,

static int initialize_enc_param(struct vpu_ctx *ctx)
{
    struct vpu_attr *attr = get_vpu_ctx_attr(ctx);
    pMEDIAIP_ENC_PARAM param = &attr->param;
    
    ----
    ----    

+   param->eProfile = MEDIAIP_ENC_PROF_H264_HP;
}

Is it enough to configure the VPU profile to HIGH?
Do I need to do anything extra?
How to validate my VPU properly configured to MEDIAIP_ENC_PROF_H264_HP?

Thanks,
Koil Arul Raj.S

Labels (2)
0 Kudos
5 Replies

2,780 Views
koilarulraj
Contributor II

Hi,

Sorry for the wrong VPU kernel driver indication form iMX8M Mini above.

From iMX_Reference_Manual Rev. L4.14.62_1.0.0_beta, 11/2018, I could confirm that, iMX8M Mini uses Hantro VPU as shown below,

VPU_1_3.png

The following diagram shows the VPU_H1 Register 18 fields (SWREG18).

VPU_h1_1.png

VPU_1_2.png

From the above register definition,
  - Setting Bit 21 will make encoder set in High Profile
  - Setting Bit 18 will make encoder set in Main Profile
  - Clearing Bit 18 will make encoder set in Base Profile

Is my understanding of this correct?

We are using Kernel version 4.14.78. In the kernel corresponding driver for Hantro VPU Encoder is "drivers/mxc/hantro_845_h1/hx280enc.c"

I tried changing the H264 Profile to HIGH by configuring VPU_H1 Register 18, in the "hx280enc_init(void)" function present in the encoder driver file "drivers/mxc/hantro_845_h1/hx280enc.c" as follows,

static int __init hx280enc_init(void)
{
u32 vpu_h1_reg18;

---
---

+    vpu_h1_reg18 = readl(hx280enc_data.hwregs + 0x48);
+    pr_info("hx280enc: vpu_h1_reg18 <%x>\n", vpu_h1_reg18);
+    vpu_h1_reg18 |= (1 << 21);                                 /*H.264 Transform 8x8 enable. High Profile H.264. transform8x8Mode*/
+    pr_info("hx280enc: vpu_h1_reg18 <%x>\n", vpu_h1_reg18);
+    writel(vpu_h1_reg18, hx280enc_data.hwregs + 0x48); /* SWREG18 */

}

Am I configuring the HX280 encoder correctly to high profile? Is there any way to validate High profile encoding?

Kinldy help me to resolve this.

Thanks,

Koil Arul Raj.S

0 Kudos

2,780 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Koil,

Your configuration is correct, there´s i a way to validate the high profile encoding but is under professional services, you can get a quotation under:

NXP Professional Services | NXP 

Regards

0 Kudos

2,780 Views
koilarulraj
Contributor II

Hi Bio_TICFSL

Thanks for your confirmation.

I need few more clarification regarding iMX8M Mini VPU encoder.

As per TRM,
  - All the three profiles has encoding level 1 - 5.1
  - The Bitrate is also common to all the three profiles. (Min 10Kbps and Max 40 Mbps)
So, How does the iMX8M mini VPU encoder differentiates the quality between three profiles?

Is it possible to set bitrate and level in the kernel? Because we couldn't find any register definition regarding these fields in the TRM.

When we checked the recorded video in all the three profiles, we couldn't see much difference in the file size. But the streaming quality shows improvement in Main and High profile when compared with Base profile.

I want to know, is there any other possible configuration available for high profile encoding which I can set in iMX8M mini kernel? Is there any specific configurations to boost high profile encoding in iMX8M Mini?

Kinldy confirm.

Thanks,

Koil Arul Raj.S

0 Kudos

2,780 Views
koilarulraj
Contributor II

Hi,

Is there any updates on the above queries?

Also can anyone explain the software architecture and working concept of hx280 encoder in iMX8MM?

The kernel driver,  "drivers/mxc/hantro_845_h1/hx280enc.c" just handles the interrupts and status of the hardware encoder. Which code handles the buffer allocation and initialization of the encoding in iMX8MM hardware vpu encoder?

Thanks,

Koil Arul Raj.S

0 Kudos

1,856 Views
vincentz63
Contributor IV

Hi there,

I am also trying to work out how to configure the encoder of the i.MX8MMini; did you get anywhere? Did you manage to set it to High profile?

Thanks

JP

0 Kudos