- Sep 06, 2022
-
-
Bartłomiej Grzesik authored
This patch adds a Android system property persist.vendor.v4l2_codec2.disable_vbr. The property allows user to disable option to encode with variable bitrate in runtime. This change is required for a temporary workaround for b/235771157. Bug: 235771157, 238835187 Test: android.video.cts.VideoEncoderDecoderTest#testVp8Other0Perf0640x0360 Change-Id: I4a9931431354193968f8255d0d501aed02ee3508 (cherry picked from commit f9f4b5681ff4fc22cd83192b17693d90922134c7)
-
- Jun 24, 2022
-
-
Alexandre Courbot authored
Patch 0fa30254bd7e introduced a type mismatch when building for 32-bit architecture. This error is visible when running "mmm external/v4l2_codec2": external/v4l2_codec2/components/V4L2EncodeComponent.cpp:782:32: error: no matching function for call to 'max' int64_t newFramerate = std::max( ^~~~~~~~ external/libcxx/include/algorithm:2529:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('long' vs. 'long long') max(const _Tp& __a, const _Tp& __b) ^ external/libcxx/include/algorithm:2539:1: note: candidate template ignored: could not match 'initializer_list<type-parameter-0-0>' against 'long' max(initializer_list<_Tp> __t, _Compare __comp) ^ external/libcxx/include/algorithm:2547:1: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided max(initializer_list<_Tp> __t) ^ external/libcxx/include/algorithm:2521:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ Fix this by casting the right member of the cmp operation to int64_t. Test: mmm external/v4l2_codec2 Change-Id: Id2cc220b9122eec412823f577f07ecd82bad60fc (cherry picked from commit a0377993b84da09547aad11f2f27560e0bf4dcd5)
-
- Jun 02, 2022
-
-
Shao-Chuan Lee authored
Dynamic framerate based on timestamps can become zero when input frames are supplied at >1 sec intervals. Bug: 228828942 Test: android.media.cts.EncodeVirtualDisplayWithCompositionTest#testVirtualDisplayRecycles Test: com.google.android.media.gts.RtcVideoCodecTest#testDynamicFramerateChangeVp8 Change-Id: I3ceefaad9b420f86e4f0b524e6f0b5649af9997b
-
- May 26, 2022
-
-
Jeffrey Kardatzke authored
This adds support for the HEVC/H265 codec to the Android codec2 V4L2 decode component. Bug: 215043150 Bug: 183217901 Test: ExoPlayer works with HEVC on guybrush w/ codecs added and corresponding ChromeOS CLs for crosvm/libvda Change-Id: I3707e9730d245871b74982527edfebe81b484e8a (cherry picked from commit 05bacef7fa53541f21c85f26f6f8351dcdfd7f0e)
-
- Nov 01, 2021
-
-
Chih-Yu Huang authored
When we allocate V4L2 output buffers, the driver might change the number of buffers. This CL respects the number of buffers from V4L2 driver, instead of using the original requested number. Bug: 202923667 Test: pass e2e test Change-Id: Ic0d8e34014a0e3015bb995026f4b17f50c6b578e
-
- Oct 20, 2021
-
-
Chih-Yu Huang authored
Bug: None Test: mmm external/v4l2_codec2 Change-Id: I21d5d30ce32279dfb1cbe2b40d435d2e9707f5aa
-
Chih-Yu Huang authored
After the component is destroyed, we cannot use shared_from_this() because there must be a valid shared_ptr pointing to the component. This CL changes to use weak_from_this() to get weak_ptr, and locks the weak_ptr when we need shared_ptr. Also, the parameter of Component::Listener's methods is weak_ptr, instead of shared_ptr. This CL also changes to pass weak_ptr to the listener. Bug: 198215986 Test: android.media.cts.VideoEncoderTest#testOtherH264SurfArbitraryH Change-Id: I3bae943f211db5f68e3b9a86bc193eee09cba65e
-
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
-
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
-
David Staessens authored
Currently an FD is stored inside the BitstreamBuffer object. This CL moves the C2 linear block buffer directly inside the BitstreamBuffer. This makes management of output buffers in the encoder simpler as we don't need to manually keep output buffers alive. This is also required by subsequent CLs that introduce functionality to prepend H.264 SPS and PPS NAL units to IDR frames in the video stream. Since both the decoder and encoder make use of the BitstreamBuffer class and both have different requirements some changes needed to be made. The decoder uses a 'C2ConstLinearBlock' as bitstream buffers are used as input and do not need to be modified. The encoder uses a 'std::shared_ptr<C2LinearBlock>' as the encoded output stream will be written to a bitstream buffer object. To accommodate these requirements the BitstreamBuffer object is split up into a 'BitstreamBuffer' and 'ConstBitstreamBuffer' object. BUG: 161495502 Test: arc.VideoEncodeAccel.h264_192p_i420_vm Change-Id: Icfd0a84ef09cf283510763c51f92fe83bc7166c2
-
David Staessens authored
Currently the C2Config::LEVEL_AVC_4_2 level is not advertised as supported value for the C2_PARAMKEY_PROFILE_LEVEL parameter. This causes the V4L2 encoder to use the next supported level LEVEL_AVC_5, making the EncoderProfileLevelTest#testValidateProfileLevel CTS test fail. BUG: 188415875 Test: EncoderProfileLevelTest#testValidateProfileLevel Change-Id: Ifd5caa6d70c592a7379260876600b075432ac7d8
-
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
-
David Staessens authored
The GTS testDynamicFramerateChangeVp8 test expects the VP8 V4L2 encoder to dynamically adjust the framerate based on the frame timestamps during encoding. This CL makes changes to the V4L2 encoder to monitor the time difference between subsequent frames and adjust the framerate accordingly. BUG: 192419592 Test: media.gts.RtcVideoCodecTest#testDynamicFramerateChangeVp8 Change-Id: Ic2f6d905345d9678765ad9db93e430d4ebddd602
-
David Staessens authored
This CL changes the V4L2 encode component to not try to extract H.264 NAL units from an encoded VP8/9 video stream. Parsing for NAL units in a VP8/9 stream doesn't break encoding as an empty list is returned, but returning an empty config update to the mediacodec framework makes the GTS VP8 RtcVideoCodecTest fail. BUG: 191644279 BUG: 155138243 Test: media.gts.RtcVideoCodecTest#testDynamicBitrateChangeVp8 Change-Id: I789eb0c948afaea29e1595a503d63cd3788baf1b
-
- Jun 30, 2021
-
-
Chih-Yu Huang authored
CCodecBufferChannel (CCBC) set the number of output slots to "output delay + kSmoothnessFactor". CCBC would pause sending input buffers to the component when all the output slots are filled by pending decoded buffers. If the available output buffers are exhausted at the output slots before CCBC pause sending input buffers, CCodec would treat this situation as timeout easily. This CL increases the number of output buffer more than the number of output slots to prevent this situation from happening. Note: CCodec measures the elapsed time between CCBC passes a input buffer to the component and the component returns the corresponding output buffer back to CCBC. If the elapsed time is greater than a threshold, then CCodec considers the component stop working. Bug: 184020290 Test: android.media.cts.VideoEncoderTest#testGoogH264Flex1080p Change-Id: I38502d77d247499f1fcc5b434f18ad5e6edbfcb9 (cherry picked from commit 5d06eade6f296b88eacb8619e04ba96a9e60deb7)
-
- Jun 07, 2021
-
-
Chih-Yu Huang authored
Originally we use "debug" group to save the configuration. However, the value should be read-only at run-time. "ro.vendor" is a better group for the usage case. Bug: 189059445 Test: android.media.cts.AdaptivePlaybackTest Change-Id: I04cfd8498b6bafdd0a4ee6ea16d002c9f50bdc0d
-
David Staessens authored
This CL fixes an incorrect check that causes encoding of VP8 and VP9 videos to fail, by incorrectly performing setup only required for H.264 encoding. Bug: 189725332 Bug: 155138243 Test: arc.VideoEncodeAccel.vp8_192p_i420_vm on hatch Change-Id: I76a8c9c8549f9fd630348530dd8e443f9feaf33c
-
Chih-Yu Huang authored
Originally libv4l2_codec2_common is small library that only contains some constant definitions, so it's efficient to link it as static library. Now the library becomes larger. This CL changes to link it as shared library to prevent duplicating the content into its dependency libraries and binaries. Bug: 160110407 Test: mmm external/v4l2_codec2 Change-Id: Ie0c08bdd694d7226ce430af9148e0c8919126c79
-
Chih-Yu Huang authored
Originally we always streamon the output queue after flush is done. However the output queue might not be streaming before flush. In this case we don't need to streamon the output queue. Bug: 170199771 Test: android.media.cts.AdaptivePlaybackTest Change-Id: I94f76a5737b7f6536acc169876cf0f7e9060d5bb
-
- May 12, 2021
-
-
Chih-Yu Huang authored
This CL setups the supported pixel format when resolution change. Currently the supported pixel format is flexible 420 format. Bug: 170199771 Test: android.media.cts.AdaptivePlaybackTest Change-Id: Ic1b8f5c23fa5ff14c5dba026e0d927df092a6351
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
David Staessens authored
This CL removes a workaround that was added to tackle a quality issue in b/114332827. This workaround causes the android.mediav2.cts. EncoderProfileLevelTest#testValidateProfileLevel[6(video/avc)] test to fail. It's not clear whether the issue is still present so some quality check CTS tests might start failing, but we should tackle these issues at the source. Bug: 184015100 Test: android.mediav2.cts.EncoderProfileLevelTest Change-Id: I55f275af4a421509a776e39bed669365159ba2ee
-
Chih-Yu Huang authored
Originally we forced the component into error state if there are any pending frames when drain is done. That means these frames are either no-show frames or dropped. It doesn't affect the following decoding. This CL changes to abandon pending frames instead of reporting error. Bug: 184211876 Test: android.media.cts.AdaptivePlaybackTest Change-Id: I18511f14f70579718f434f316701ee1b77c1f6f0
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
David Staessens authored
This CL performs a small bit of cleanup, renaming the V4L2 encoder states to better reflect their purpose. Bug: 143333813 Test: arc.VideoEncodeAccel.h264_192p_i420_vm Change-Id: I273c792a653110e6c4e8ba338565280eab94d442
-
David Staessens authored
This CL performs a small bit of cleanup, clearing the v4l2_rect data before performing an IOCTL. Bug: 143333813 Test: arc.VideoEncodeAccel.h264_192p_i420_vm Change-Id: Ie24daa1d37b867a53acf0734c457ba47ad6e2d12
-