Skip to content
Snippets Groups Projects
  1. Nov 08, 2021
  2. Oct 20, 2021
    • Chih-Yu Huang's avatar
      Merge latest version to Android master. · 78318668
      Chih-Yu Huang authored
      Bug: None
      Test: mmm external/v4l2_codec2
      Change-Id: I21d5d30ce32279dfb1cbe2b40d435d2e9707f5aa
      78318668
    • David Staessens's avatar
      v4l2_codec2 encoder: Add support for prepending SPS/PPS to IDR frames. · e4f1ab33
      David Staessens authored
      The V4L2 encoder requests SPS and PPS NAL units to be prepended to IDR
      frames using the V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR control, to
      improve the resilience of the encoded video stream. When this control
      is not supported a warning is logged but no other steps are taken.
      
      This CL adds functionality to manually cache and preprend SPS and PPS
      NAL units to IDR frames when the above control is unsupported.
      
      BUG: 161495502
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      
      Change-Id: I6b0906c4bdd46041f34eab7061e61f7b4a460fe2
      e4f1ab33
    • David Staessens's avatar
      v4l2_codec2 encoder: Improve extraction of SPS/PPS from H.264 streams. · d68fb2ae
      David Staessens authored
      The V4L2 encoder tries to extract SPS and PPS NAL units from H.264
      video streams, as this information needs to be provided to the
      mediacodec framework.
      
      This CL makes a number of improvements to the extraction code:
      - Upon extraction a temporary buffer is allocated using the full size
        of the encoded frame. This is adjusted to only allocate enough data
        to hold the SPS and PPS NAL units.
      - The NAL parser currently parses the complete encoded frame data. The
        code is adjusted to stop parsing after both the SPS and PPS NAL units
        are found (which are typicaly located at the start of the frame).
      
      BUG: 161495502
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I89267727029b1317057d5475e41d7126c705c2c1
      d68fb2ae
    • David Staessens's avatar
      v4l2_codec2 encoder: Add support for configuring the bitrate mode. · df5be4b9
      David Staessens authored
      This CL adds support for the C2_PARAMKEY_BITRATE_MODE parameter to the
      v4l2 encoder. This parameter allows configuring the bitrate mode used
      to encode a video.
      
      The supported bitrate modes are:
      - C2Config::BITRATE_VARIABLE
      - C2Config::BITRATE_CONST
      
      Note: Currently the C2 framework does not support configuring the peak
      bitrate, which is used when the bitrate mode is set to VBR. Instead we
      set the peak bitrate to a multiple of the target bitrate.
      
      Note: Submit after support for V4L2_CID_MPEG_VIDEO_BITRATE_PEAK and
      V4L2_CID_MPEG_VIDEO_BITRATE_MODE has been added to the virto encoder in
      crrev.com/c/2944506.
      
      BUG: 190336806
      BUG: 181514834
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I95d8f9921c1ba475ea8c65760d3c18e5e2818d5e
      df5be4b9
  3. Jun 30, 2021
    • Chih-Yu Huang's avatar
      Fourcc: Change the conversion failure log to ALOGV · 6a854908
      Chih-Yu Huang authored
      Currently, the Fourcc conversion function only accepts pixel format.
      However, the caller might pass codec fourcc like "H264" to the
      conversion function. Using ALOGE is too scary. This CL changes these
      log to ALOGV.
      
      Bug: 186838277
      Test: mmm external/v4l2_codec2
      
      Change-Id: I69f52bcbaa18af9b5f462f7eab5800df3e78a0dd
      (cherry picked from commit 5c0c5e4f0dc26ad3a3632934d6045460dcf56639)
      6a854908
  4. Jun 07, 2021
    • Chih-Yu Huang's avatar
      v4l2 common: Fix build error when enabling verbose log of V4L2Device.cpp · a109e7db
      Chih-Yu Huang authored
      SEQUENCE_CHECKER() macro does nothing when libchrome DCHECK flag is
      not enabled. We cannot use ALOG_ASSERT() for the checker variable.
      Also, we switched to Android ui::Rect class, which doesn't have
      Contains() method. This CL fixes these issues.
      
      Bug: 155138142
      Test: mmm external/v4l2_codec2 with uncomment #define LOG_NDEBUG 0
      
      Change-Id: I9960f5230166684c3b507e7b356833a1fb626fc6
      a109e7db
    • David Staessens's avatar
      v4l2_codec2: Use graceful methods to read NAL color aspects. · d8563132
      David Staessens authored
      This CL changes the color aspects H.264 NAL parser to use
      getBitsGraceful() when reading from the NALU, and check the result of
      bit operations. Reading from the NALU is currenlty safe and the bit
      reader never reads out-of-bounds, but an assert is thrown causing the
      StagefrightTest to abort rather than gracefully fail.
      
      Bug: 187402250
      Test: arc.VideoDecodeAccel.* on hatch
      Change-Id: I6abb5f485e0a6f4fb8c46c8b74e895127e9107b5
      d8563132
  5. May 12, 2021
    • Kazuhiro Inaba's avatar
      Mark VP8 decoder as valid. · e2fc88c0
      Kazuhiro Inaba authored
      It looks like the codec name was lost in ag/13694191 accidentally.
      
      Bug: 186361543
      Test: Run any CTS test and check MediaDeviceInfo.deviceinfo.json
      Change-Id: I3ed72bb3f6ea6eb88652aca778adb2fd3fe2049a
      e2fc88c0
    • David Staessens's avatar
      v4l2_codec2: remove libv4l2_codec2_accel library. · 2e813d9b
      David Staessens authored
      This CL removes the libv4l2_codec2_accel library now all files have
      been removed from the library, and updates dependent modules.
      
      Bug: 155138142
      Test: m -j32
      Change-Id: I45629ae702b12aedf9a6be256d955e702da8245d
      2e813d9b
    • David Staessens's avatar
      v4l2_codec2: Adapt VideoPixelFormat code to Android standards. · 669080c4
      David Staessens authored
      This CL reworks the VideoPixelFormat class that was branched
      from Chrome:
      - Removed all Chrome-specific references from comments
      - Removed specific numbering as we don't need compatibility with Chrome
      - Removed deprecated formats
      - Adhere to the Android coding style.
      - Make use of Android logging mechanisms.
      - Make use of Android assert macros.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I8387af0b427ebc990ec6374432f18ad732894569
      669080c4
    • David Staessens's avatar
      v4l2_codec2: Move media::VideoPixelFormat to common code. · 62508fd4
      David Staessens authored
      This CL Moves the VideoPixelFormat files to the common code folder. In a
      next step these files will be cleaned up and reworked into proper
      Android code, but splitting the move into a separate CL makes the review
      process a lot easier.
      
      Note: the "accel" folder is now empty, but the folder and Android.bp
            files will be cleaned up in a next CL so we can properly clean
            up all dependencies on the v4l2_accel module.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: Ia4708e5dbdd11223b9a2c445850b8c0cf6ee6d37
      62508fd4
    • David Staessens's avatar
      v4l2_codec2: Adapt media::Fourcc code to Android standards. · 1eec324e
      David Staessens authored
      This CL reworks the Fourcc class that was branched from Chrome:
      - Adhere to the Android coding style.
      - Make use of Android logging mechanisms.
      - Make use of Android assert macros.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I0288d7e0ff94b378f6cbba61b15098caf738229c
      1eec324e
    • David Staessens's avatar
      v4l2_codec2: Move Fourcc to common code. · 5a801016
      David Staessens authored
      This CL Moves the Fourcc files to the common code folder. In a next
      step these files will be cleaned up and reworked into proper Android
      code, but splitting the move into a separate CL makes the review
      process a lot easier.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I8d04b8538187c157f052dcd200f349313a64c7c6
      5a801016
    • David Staessens's avatar
      v4l2_codec2: Remove media::ColorPlaneFormat and media::VideoFrameLayout · df245f18
      David Staessens authored
      This CL removes all uses of the media::ColorPlaneFormat and
      media::VideoFrameLayout types that were copied from Chrome. All uses
      of ColorPlaneFormat are changed to the VideoFramePlane type in
      Common.h. To replace the Chrome VideoFrameLayout a much simpler type
      was introduced in Common.h.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: If601718351b7dd328bda65036b1a0525f8b7e0fb
      df245f18
    • David Staessens's avatar
      v4l2_codec2: Merge VideoFrame into VideoPixelFormat. · 021e7a59
      David Staessens authored
      After the recent cleanup operations the only code left in the
      VideoFrame class are helper functions directly related to the
      VideoPixelFormat. This CL merges all these helpers into
      video_pixel_format.h.
      
      Additionally a helper in the VideoFrameLayout class is also moved to
      the video_pixel_format.h, so all VideoPixelFormat-related helpers are
      in one place.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I76699ecf69eb90fe890c1c272db058938b68062b
      021e7a59
    • David Staessens's avatar
      v4l2_codec2: Switch from media::VideoCodecProfile to C2 profiles. · 52081102
      David Staessens authored
      This CL changes all uses of the media::VideoCodecProfile type that was
      copied from Chrome to their respective C2 profile counterparts. This
      removes the additional conversion between C2 profiles,
      VideoCodecProfile and V4L2 profiles. The video_codecs.h/cc files are
      removed.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I0df03215e51def6379c468a4c189104d5fbde0e9
      52081102
    • David Staessens's avatar
      v4l2_codec2: Use C2Config::PROFILE_VP8_0. · 128a6ee1
      David Staessens authored
      This CL changes the V4L2 encoder component to use the newly introduced
      C2Config::PROFILE_VP8_0 profile. This profile was initially not
      present, complicating code dealing with VP8.
      
      Note: Submit after ag/13976507
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.vp8_192p_i420_vm
      Change-Id: I4256a4871221d3f417b5f1a003cc9fcfdb3dcd0e
      128a6ee1
    • David Staessens's avatar
      v4l2_codec2: Adapt overflow check in common.cpp. · 9db55159
      David Staessens authored
      This CL changes the overflow check that's used when calculating a
      video's area in getArea() to use base::CheckedNumeric, as the current
      check is depending on undefined behavior.
      
      Bug: 155138142
      Test: arc.VideoDecodeAccel.h264_vm
      Change-Id: I1b702c663ed7d99b1199ce743196bab64302dfc3
      9db55159
    • David Staessens's avatar
      v4l2_codec2: Switch from media::VideoCodec to common VideoCodec class. · 1fb283af
      David Staessens authored
      This CL removes all uses of the media::VideoCodec type that was copied
      from Chrome, in favor of the VideoCodec definition in
      common/VideoTypes.h. The media::VideoCodec type is removed.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I9a936bd54bc4232dfb5af016073c8cf8cc86077c
      1fb283af
    • David Staessens's avatar
      v4l2_codec2: Use Android Size instead of Chrome Size. · ee231c7e
      David Staessens authored
      This CL changes the V4L2 decoder and encoder to use the Android Size
      structure instead of the one copied from Chrome, the Chrome size.h file
      is removed.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
            arc.VideoDecodeAccel.h264_vm
      Change-Id: I8f63e847d8cf4ffd33621706287a44c93a4864fd
      ee231c7e
    • David Staessens's avatar
      v4l2_codec2: Use Android Rect instead of Chrome Rect. · 8038171d
      David Staessens authored
      This CL changes the V4L2 decoder and encoder to use the Android rect
      structure instead of the one copied from Chrome, the Chrome rect.h file
      is removed.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
            arc.VideoDecodeAccel.h264_vm
      Change-Id: Ie581deee6b4b43a27c45e48269a6902526727933
      8038171d
    • David Staessens's avatar
      v4l2_codec2: Remove video_encode/decode_accelerator files. · e0f265c1
      David Staessens authored
      This CL cleans up the video_encode_accelerator.h/cc and
      video_decode_accelerator.h/cc files. These files were copied from
      Chrome to help with the development of the V4L2 encoder and decoder,
      but most off their functionality has already been removed in a previous
      CL. The remaining functionality is integrated into the V4L2Device so
      these files can be removed now.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I4591e3d03f5ebc6d568cc718ccde5df05af37b36
      e0f265c1
    • David Staessens's avatar
      v4l2_codec2: Adapt V4L2 device and V4L2 device poller for Android. · 2a741c31
      David Staessens authored
      This CL reworks the V4L2 device and V4L2 device poller code that was
      branched from their Chrome counterparts:
      - Adhere to the Android coding style.
      - Make use of Android logging mechanisms.
      - Make use of Android assert macros.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I4842624e7fae9fc3f52d90dc90a5e7c026c63513
      2a741c31
    • David Staessens's avatar
      v4l2_codec2: Remove request-related code from V4L2 device. · d8ec69fd
      David Staessens authored
      This CL removes leftover code related to V4L2 requests from the V4L2
      device, as it's currently not functional nor used.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I98702a74778e84f1aec00f8f216c9c4f1c16c261
      d8ec69fd
    • David Staessens's avatar
      v4l2_codec2: Remove image processor and JPEG support from V4L2 device. · 183cceb1
      David Staessens authored
      This CL removes leftover code related to image processor support and
      JPEG encoding/decoding from the V4L2 device, as it's currently not
      used.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I34fe7819e78b93a9a9d33e4888e56aba5f9826cb
      183cceb1
    • David Staessens's avatar
      v4l2_codec2: Remove unused member variable from V4L2 device. · a87b1cda
      David Staessens authored
      This CL performs a small bit of cleanup by removing an unused member
      variable from the V4L2 device.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I3ef7c7fd28db30137ca7b4e1a52c031e6dcc0591
      a87b1cda
    • David Staessens's avatar
      v4l2_codec2: Merge generic V4L2 device into V4L2 device. · 78f6641e
      David Staessens authored
      This CL merges the V4L2Device and GenericV4L2Device code. The code was
      copied from Chrome where multiple device types are possible, but in
      Android we only have a single implementation.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I16ee2af26f5dd89cdc44c83170b8be74baaec186
      78f6641e
    • David Staessens's avatar
      v4l2_codec2: Remove unused defines from V4L2 device. · e039d281
      David Staessens authored
      This CL performs minor cleanup and removes a few unused defines from
      the V4L2 device.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I8d486775f3e1b8618f6a82dd02932892f143a17a
      e039d281
    • David Staessens's avatar
      v4l2_codec2: Move V4L2 device and device poller to common code. · 69f5a3b9
      David Staessens authored
      This CL Move the V4L2 device and V4L2 device poller files to the common
      code folder. In a next step these files will be cleaned up and reworked
      into proper Android code, but splitting the move into a separate CL
      makes the review process a lot easier.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I4c4c9d7f5c7e85feed10ed1e3fd9b8fa14ca67ae
      69f5a3b9
    • David Staessens's avatar
      v4l2_codec2: Expand NALParser to support parsing color aspects. · fdbe4007
      David Staessens authored
      This CL expands the simple NALParser to support parsing color aspects
      from the SPS NAL unit. The V4L2 decode component is adapted to use this
      new NALParser rather than the Chrome parser. This allows us to remove
      the Chrome H.264 parser and its associated dependencies in a subsequent
      CL, removing a lot of code.
      
      Bug: 155138142
      Test: arc.VideoDecodeAccel.* and arc.VideoDecodeAccelPerf.* on hatch
      Change-Id: Icbfa63478980ab2b2d1bf2d46697359a0ac92937
      fdbe4007
    • David Staessens's avatar
      v4l2_codec2: Move NALParser code to separate file. · a95d4ed1
      David Staessens authored
      This CL moves the simple NALParser to a dedicated file. The parser will
      be expanded in a subsequent CL so moving the code in a separate CL will
      make it easier to distinguish newly made changes.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I9691de7e610a4c9881c29dbdc337ae9d01668145
      a95d4ed1
    • David Staessens's avatar
      v4l2_codec2: Cleanup unused includes. · b6746213
      David Staessens authored
      This CL cleans up a few unused includes in the encode helpers.
      
      Bug: 155138142
      Test: arc.VideoEncodeAccel.h264_192p_i420_vm
      Change-Id: I41edd1d95b92410d8bb143ebb2d2da26eef0c01e
      b6746213
  6. Mar 15, 2021
    • David Staessens's avatar
      v4l2_codec2: Add support for VP8/VP9 to the V4L2 encoder. · 01d7532a
      David Staessens authored
      This CL adds support for the VP8 and VP9 codecs to the Android codec2
      V4L2 encode component.
      
      note: VP8 is currently disabled on most Intel devices due to
            b/158655609
      
      Bug: 155138243
      Test: tast run DUT arc.VideoEncodeAccel.vp8_1080p_i420 on hatch
            tast run DUT arc.VideoEncodeAccel.vp9_1080p_i420 on rammus
      Change-Id: Ic3d58d711633b4ffb481813b3016d7c369a9f8f0
      01d7532a
  7. Feb 13, 2021
    • Bob Badour's avatar
      [LSC] Add LOCAL_LICENSE_KINDS to external/v4l2_codec2 · b1d153c0
      Bob Badour authored
      Added SPDX-license-identifier-BSD to:
        accel/Android.bp
        common/Android.bp
        components/Android.bp
        plugin_store/Android.bp
        service/Android.bp
        store/Android.bp
        tests/c2_comp_intf/Android.bp
      
      Added SPDX-license-identifier-BSD legacy_unencumbered to:
        Android.bp
        tests/c2_e2e_test/jni/Android.mk
      
      Bug: 68860345
      Bug: 151177513
      Bug: 151953481
      
      Test: m all
      
      Exempt-From-Owner-Approval: janitorial work
      Change-Id: I4ef032a3849d650e13761a868b45309275d408a2
      b1d153c0
  8. Jan 12, 2021
    • David Staessens's avatar
      v4l2_codec2: Use H.264 V4L2 levels instead of IDC levels in encoder. · dddb478e
      David Staessens authored
      The H.264 levels currently requested by the C2 V4L2 encoder are H.264
      IDC levels rather than the required V4L2 levels. This CL changes the
      encoder to request the correct levels.
      
      Bug: 174967472
      Test: android.media.cts.MediaRecorderTest#testProfileAvcBaselineLevel1
      
      Change-Id: Ic05a919a4f8a8dd1d0b0acc6577951c88c229469
      dddb478e
    • David Stevens's avatar
      v4l2_codec2: pass SW flags in getGraphicBlockInfo · 5724718e
      David Stevens authored
      On ARCVM, using no SW flags when locking a buffer causes it to return
      the host buffer stride/offsets. This isn't what is desirable here, as
      the buffer dimensions here are used for validation of the guest buffer
      within the guest kernel. To get the guest stride/offsets, we need to
      pass SW flags when locking the buffer.
      
      Note that crosvm switches to using the host stride/offsets before
      passing the buffers to libvda.
      
      Bug: 173667442
      Test: android.media.cts.VideoEncoderTest#testOtherH264SurfArbitraryW
      
      Change-Id: I1c87a12179fd3ed3f17c0414f7266506746a96b9
      5724718e
    • David Stevens's avatar
      components: Set InputBufferManager interval · 79dd1273
      David Stevens authored
      InputBufferManager notifies the codec2 framework when the component no
      longer has any references to an input buffer. While a dedicated release
      notification is necessary in some circumstances, the release can usually
      be done when the corresponding work item is completed, to reduce the
      amount of IPC. This change sets the notification interval used by
      InputBufferManager to reduce how often a dedicated release notification
      is sent.
      
      Bug: 172184040
      Test: tast run DUT arc.VideoDecodeAccel.vp8_vm
      
      Change-Id: Id6371d328bb00730b50d3b3075eccf4010554f27
      79dd1273
  9. Aug 31, 2020
    • David Staessens's avatar
      v4l2_codec2: Remove duplicated HalPixelFormat and InputCodec types. · efdbd3dc
      David Staessens authored
      This CL removes the duplicate HalPixelFormat and InputCodec types in
      common.h that are also present in VideoTypes.h.
      
      VideoTypes.h is moved to the common/ folder so it can also be used by
      other classes.
      
      note: Submit together with ag/12467730
      
      Bug: 143333813
      Test: tast run $HOST arc.VideoEncodeAccel.h264_vm on hatch-arc-r
      Change-Id: I93bca14a3b2f0c4c49104149d5683193554ba3eb
      efdbd3dc
  10. Jul 22, 2020
    • David Staessens's avatar
      v4l2_codec2: Implement Codec2 V4L2 encode component. · 30cf47e3
      David Staessens authored
      This CL introduces the first version of the new codec2 V4L2 encoder.
      The V4L2EncodeComponent currently only supports H264, support for
      additional formats will introduced later.
      
      The encode component is developed and tested on ARC++ and the initial
      version is not functional yet on ARCVM. The changes required to fully
      enable the encoder on ARCVM (such as support for DMABufs) will be
      introduced in follow-up CLs.
      
      Currently the component makes heavy use of Chromium helpers as it's
      based on the Chromium V4L2VideoEncodeAccelerator, but in the future
      the amount of dependencies will be reduced.
      
      The new V4L2 encoder is currently not enabled by default, which requires
      additional changes in media_codecs_c2.xml.
      
      Bug: 143333813
      Test: mmm external/v4l2_codec2
      Change-Id: I59ba52e8f85aa40c8d23a451fb2842a7a421412a
      30cf47e3
Loading