Jump to content

genesys

Members
  • Posts

    4
  • Joined

  • Last visited

Reputation Activity

  1. Like
    genesys reacted to jernej in 4kp30 video on Orange Pi Lite and mainline hardware acceleration   
    Hi!
     
    HW video decoding on mainline kernel is possible, but in most cases you have to do some kernel patching yourself and use special library which provides VAAPI or use modified ffmpeg libraries. MPEG2 decoding is possible with kernel 5.0 or 5.1 (not sure), basic H264 decoding will be possible with kernel 5.3 and HEVC decoding will probably come with kernel 5.5 (patches already exist). Note that H264 and HEVC codecs are feature incomplete currently. However, I did some improvements for LibreELEC and there most H264 and HEVC videos work. Patches are available on LibreELEC github but are incompatible with VAAPI library, so only option is to use modified ffmpeg.
     
    Regarding memory consumption, please note that with OrangePi Lite you have only 512 MiB of RAM which is a bit low. LibreELEC for that reason doesn't support devices with less than 1 GiB of RAM. Consider following calculations for memory requirements, no matter which kernel you use:
    1. Multiple variants of 4K and 1440p resolutions exist, so I'll assume that 4K means 4096x2160 (same as on my LG TV) and 1440p means 2560x1440
    2. kernel allocates one XRGB (4 bytes per pixel) buffer for user interface (no matter if you're using window manager or not), so for that you need 4096*2160*4 ~ 34 MiB of CMA memory
    3. video is decoded to NV12 or NV21 formats and both take 1.5 byte per pixel, that means 2560*1440*1.5 = 5.27 MiB of CMA memory per single frame
    4. worst case for H264 and HEVC is that you need 16 reference frames to properly decode current frame, which means additional 5.27 * 16 ~ 84 MiB of CMA memory
    5. VPU needs additional scratch buffers per frame. Size of those buffers depends on codec features used, but for H264 is typically about 1/4th of multiplied width and height, so in worst case (1 + 16)*2560*1440/4  ~ 15 MiB of CMA memory
    6. VPU needs some other scratch buffers, but they are small, about 1 MiB in total
    7. you also need additional CMA memory for providing encoded data to VPU, but memory consumption for that heavily depends on userspace library/player implementation. Hard to give any estimation, so let's use 20 MiB.
     
    Final estimation for worst case display + VPU CMA consumption for 4K display and 1440p video: 34 + 5.27 + 84 + 15 + 1 + 20 ~ 160 MiB. You also have to consider that other devices may use CMA memory at the same time. In LibreELEC, CMA memory size is set to 256 MiB because so much is needed for decoding 4K videos.
     
    Hopefully that gives you perspective how much memory is needed for H264/HEVC video decoding.
     
    I won't touch (use) 3.4 kernel anymore, but I can help you with patching mainline kernel for better H264 and/or HEVC support and bring up ffmpeg based solutions (that includes mpv), if you want.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines