1. 18 Mar, 2022 10 commits
    • CTCaer's avatar
      codecs: nvv4l2: support all different timestamps · 1d0dbfb7
      CTCaer authored
      Various packets and players have different timestamps defined.
      
      For example old mpeg videos do not have PTS and many streaming apps or other players do not have or remove PTS.
      
      In such cases if user pts (reordered_opaque) is not set, set AV_NOPTS_VALUE instead of 0.
      
      In cases where user PTS is provided, use a flag so we know in capture plane that this is the case. Then set pts to AV_NOPTS_VALUE and reordered opaque properly.
      
      That works quite well with NVV4L2 because it reorders the frames automatically.
      And so we just need to set the proper timestamp on queued buffer, along with a flag to identify it's not PTS but user based PTS.
      1d0dbfb7
    • CTCaer's avatar
      codecs: nvv4l2: use sessions for transformations · eceaecff
      CTCaer authored
      Some apps use different processes for init and decoding.
      
      NvBuffer transformations happen on both pids.
      
      So use NvBuffer Session as parameter to id in order to not cause a crash.
      
      That's because nvbuffer_utils can't handle gracefully any error. It just segfaults.
      eceaecff
    • CTCaer's avatar
      codecs: nvv4l2: fix hanging on event wait if no full frame info · c0832ff4
      CTCaer authored
      Sometimes the decoder can be opened with no packet sent or not many for a frame to be decoded.
      
      In such cases the thread will get stuck for 50s waiting for a resolution event to happen.
      
      Use the streamon and eos checks properly to get out of such a loop.
      c0832ff4
    • CTCaer's avatar
      codecs: nvv4l2: various bugfixes · 73aba81a
      CTCaer authored
      73aba81a
    • CTCaer's avatar
      codecs: nvv4l2: add two-pass cbr mode support · 9d3282af
      CTCaer authored
      To enable, use `twopass=on` as encoder option.
      
      This also forces CBR mode, even if VBR was defined in options.
      9d3282af
    • CTCaer's avatar
      codecs: nvv4l2: align line width to 64B · 280522f4
      CTCaer authored
      Transformations of formats to formats of simply Block linear to Pitch are done in HW.
      
      VIC is responsible for that and has the limitation that width must be aligned to 64 Bytes.
      
      This allows the decoder to work with every single non standard resolution, effectively bringing full support to any video.
      
      That is particularly important on emulators that use ffmpeg for decoding in game videos which sometimes are used as backgrounds.
      These have weird dimensions and need that fix.
      
      The output frame of course has the original line width.
      280522f4
    • CTCaer's avatar
      codecs: nvv4l2: support multiple L4T versions with single build · 02d9583d
      CTCaer authored
      Nvidia has the tendency to break compatibility on documented apis for no reason.
      
      Adding new values to enums in-between older values and not the end is unacceptable.
      
      A heuristic is now in use that can identify NvBuffer version and adjusts such values accordingly.
      
      That depends on using nvv4l2_ext_utils header with the specific values there.
      02d9583d
    • CTCaer's avatar
      0fd5fb90
    • CTCaer's avatar
      codecs: nvv4l2: use atomics for pool · fd622ef8
      CTCaer authored
      Do not lock with mutexes until we need to do more in pools. Use atomics for now to lower latency.
      fd622ef8
    • CTCaer's avatar
      codecs: nvv4l2: do not use external headers · 8e286f3f
      CTCaer authored
      Make needed headers builtin as this will help to bring compatibility from r32.3.1 till r32.7.1 and newer with a single build.
      8e286f3f
  2. 06 Mar, 2022 2 commits
  3. 05 Mar, 2022 2 commits
    • CTCaer's avatar
      fftools/libavformat: Enforce nvv4l2 · b58c7002
      CTCaer authored
      This enforces NVV4L2 even if user requests another codec.
      Additionally, it forces nvv4l2 to go through software codecs first to get context if needed.
      b58c7002
    • CTCaer's avatar
      codecs: add nvv4l2 codec for Nvidia Tegra SOCs · 33680137
      CTCaer authored
      Use `--enable-nvv4l2` to enable it.
      
      This Codec uses customized V4L2, called NVV4L2 that adds various features.
      NVV4L2 uses the Tegra HW video engines NVDEC and NVENC.
      
      Decoder features:
      - Codecs: MPEG2, MPEG4, H264, HEVC, VP8, VP9
      - Output: YUV420, NV12
      - Low latency mode for realtime streaming by using `AV_CODEC_FLAG_LOW_DELAY`
      - Higher throughput than original Nvidia specs and provided software.
        (Tegra X1: 4k@63, 1080p@265, 720p@439)
      
      Encoder features:
      - Codecs: H264, HEVC
      - Output: YUV420, YUV444, NV12, P010
      - Higher throughput than original Nvidia specs and provided software.
        (Tegra X1: 4k@60, 1080p@202, 720p@414)
      
      - Options for H264:
        profile: baseline, main (default), high, high444
        level: 1.0 to 5.1 (default). (5.1 is L4T kernel limitation. Max is 6.2.)
        rc: cbr, vbr (default)
        lossless: off (default), on. (Sets profile to high444 and constant QP to 0)
        preset: default (medium), slow, medium (default), fast, ultrafast
        num_capture_buffers: 1 to 32. (Default: 10)
        AVCodec defaults: b: 5M, g: 50, all others unchanged.
      
      - Options for HEVC:
        profile: main (default), main10
        tier: main (default), high
        level: 1.0 to 6.2 (default)
        rc: cbr, vbr (default)
        lossless: off (default), on. (Sets constant QP to 0)
        preset: default (medium), slow, medium (default), fast, ultrafast
        num_capture_buffers: 1 to 32. (Default: 10)
        AVCodec defaults: b: 5M, g: 50, all others unchanged.
      
      Decoder to Encoder speed:
      FPS are halved.
      
      Some formats are supported from Tegra X1 and up.
      For more, check the NVDEC/NVENC version support matrix.
      33680137
  4. 29 May, 2021 1 commit
  5. 22 May, 2021 1 commit
  6. 20 May, 2021 1 commit
  7. 19 May, 2021 1 commit
  8. 14 May, 2021 1 commit
  9. 13 May, 2021 1 commit
    • Jan Ekström's avatar
      ffmpeg: return no chosen output if an uninitialized stream is unavailable · 70405dd7
      Jan Ekström authored
      Otherwise the rate emulation logic in `transcode_step` never gets
      hit, and the unavailability flag never gets reset, leading to an
      eternal loop with some rate emulation use cases.
      
      This change was missed during the rework of ffmpeg.c, in which
      encoder initialization was moved further down the time line in
      commit 67be1ce0 . Previously,
      as the encoder initialization had happened earlier, this state was
      not possible (flow getting as far as hitting the rate emulation logic,
      yet not having the encoder initialized yet).
      
      Fixes #9160
      
      (cherry picked from commit ec20b813)
      70405dd7
  10. 12 May, 2021 2 commits
  11. 10 May, 2021 1 commit
  12. 02 May, 2021 3 commits
  13. 29 Apr, 2021 1 commit
  14. 24 Apr, 2021 1 commit
  15. 18 Apr, 2021 1 commit
    • Timo Rothenpieler's avatar
      avcodec/nvenc: fix lossless tuning logic · e3fb0f0c
      Timo Rothenpieler authored
      Relying on the order of the enum is bad.
      It clashes with the new presets having to sit at the end of the list, so
      that they can be properly filtered out by the options parser on builds
      with older SDKs.
      
      So this refactors nvenc.c to instead rely on the internal NVENC_LOSSLESS
      flag. For this, the preset mapping has to happen much earlier, so it's
      moved from nvenc_setup_encoder to nvenc_setup_device and thus runs
      before the device capability check.
      e3fb0f0c
  16. 11 Apr, 2021 2 commits
  17. 10 Apr, 2021 1 commit
  18. 09 Apr, 2021 1 commit
  19. 08 Apr, 2021 7 commits