blob: 42274a1beb609b468fab83c07f98dab94137c46e [file] [log] [blame] [view]
Alexandre Courbot2cad5de2018-11-08 09:13:291# Using the Video Decode/Encode Accelerator Unittests Manually
2
3VDAtest (or `video_decode_accelerator_unittest`) and VEAtest (or
4`video_encode_accelerator_unittest`) are unit tests that embeds the Chrome video
5decoding/encoding stack without requiring the whole browser, meaning they can
6work in a headless environment. They includes a variety of tests to validate the
7decoding and encoding stacks with h264, vp8 and vp9.
8
9Running these tests manually can be very useful when bringing up a new codec, or
10in order to make sure that new code does not break hardware decoding and/or
11encoding. This document is a walk though the prerequisites for running these
12programs, as well as their most common options.
13
14## Prerequisites
15
16The required kernel drivers should be loaded, and there should exist a
17`/dev/video-dec0` symbolic link pointing to the decoder device node (e.g.
18`/dev/video-dec0` → `/dev/video0`). Similarly, a `/dev/video-enc0` symbolic
19link should point to the encoder device node.
20
21The unittests can be built by specifying the `video_decode_accelerator_unittest`
22and `video_encode_accelerator_unittest` targets to `ninja`. If you are building
23for an ARM board that is not yet supported by the
24[simplechrome](https://chromium.googlesource.com/chromiumos/docs/+/master/simple_chrome_workflow.md)
25workflow, use `arm-generic` as the board. It should work across all ARM targets.
26
27For unlisted Intel boards, any other Intel target (preferably with the same
28chipset) should be usable with libva. AMD targets can use `amd64-generic`.
29
30## Basic VDA usage
31
32The `media/test/data` folder in Chromium's source tree contains files with
33encoded video data (`test-25fps.h264`, `test-25fps.vp8` and `test-25fps.vp9`).
34Each of these files also has a `.md5` counterpart, which contains the md5
35checksums of valid thumbnails.
36
37Running the VDAtest can be done as follows:
38
39 ./video_decode_accelerator_unittest --disable_rendering --single-process-tests --test_video_data=test_video
40
41Where test_video is of the form
42
43 filename:width:height:numframes:numfragments:minFPSwithRender:minFPSnoRender:profile
44
45The correct value of test_video for each test file follows:
46
47* __H264__: `test-25fps.h264:320:240:250:258:35:150:1`
48* __VP8__: `test-25fps.vp8:320:240:250:250:35:150:11`
49* __VP9__: `test-25fps.vp9:320:240:250:250:35:150:12`
50
51So in order to run all h264 tests, one would invoke
52
53 ./video_decode_accelerator_unittest --disable_rendering --single-process-tests --test_video_data=test-25fps.h264:320:240:250:258:35:150:1
54
55## Test filtering options
56
57`./video_decode_accelerator_unittest --help` will list all valid options.
58
59The list of available tests can be retrieved using the `--gtest_list_tests`
60option.
61
62By default, all tests are run, which can be a bit too much, especially when
63bringing up a new codec. The `--gtest_filter` option can be used to specify a
64pattern of test names to run. For instance, to only run the
65`TestDecodeTimeMedian` test, one can specify
66`--gtest_filter="*TestDecodeTimeMedian*"`.
67
68So the complete command line to test vp9 decoding with the
69`TestDecodeTimeMedian` test only (a good starting point for bringup) would be
70
71 ./video_decode_accelerator_unittest --disable_rendering --single-process-tests --test_video_data=test-25fps.vp9:320:240:250:250:35:150:12 --gtest_filter="*TestDecodeTimeMedian*"
72
73## Verbosity options
74
75The `--vmodule` options allows to specify a set of source files that should be
76more verbose about what they are doing. For basic usage, a useful set of vmodule
77options could be:
78
79 --vmodule=*/media/gpu/*=4
80
81## Testing performance
82
83Use the `--disable_rendering --rendering_fps=0 --gtest_filter="DecodeVariations/*/0"`
84options to max the decoder output and measure its performance.
85
86## Testing parallel decoding
87
88Use `--gtest_filter="ResourceExhaustion*/0"` to run 3 decoders in parallel, and
89`--gtest_filter="ResourceExhaustion*/1"` to run 4 decoders in parallel.
90
91## Wrap-up
92
93Using all these options together, we can invoke VDAtest in the following way for
94a verbose H264 decoding test:
95
96 ./video_decode_accelerator_unittest --single-process-tests --disable_rendering --gtest_filter="*TestDecodeTimeMedian*" --vmodule=*/media/gpu/*=4 --test_video_data=test-25fps.h264:320:240:250:258:35:150:1
97
98## Basic VEA usage
99
100The VEA works in a similar fashion to the VDA, taking raw YUV files in I420
101format as input and producing e.g. a H.264 Annex-B byte stream. Sample raw YUV
102files can be found at the following locations:
103
104* [1080 Crowd YUV](http://commondatastorage.googleapis.com/chromiumos-test-assets-public/crowd/crowd1080-96f60dd6ff87ba8b129301a0f36efc58.yuv)
105* [320x180 Bear YUV](http://commondatastorage.googleapis.com/chromiumos-test-assets-public/bear/bear-320x180-c60a86c52ba93fa7c5ae4bb3156dfc2a.yuv)
106
107It is recommended to rename these files after downloading them to e.g.
108`crowd1080.yuv` and `bear-320x180.yuv`.
109
110The VEA can then be tested as follows:
111
112 ./video_encode_accelerator_unittest --single-process-tests --disable_flush --gtest_filter=SimpleEncode/VideoEncodeAcceleratorTest.TestSimpleEncode/0 --test_stream_data=bear-320x180.yuv:320:180:1:bear.mp4:100000:30
113
114for the `bear` file, and
115
116 ./video_encode_accelerator_unittest --single-process-tests --disable_flush --gtest_filter=SimpleEncode/VideoEncodeAcceleratorTest.TestSimpleEncode/0 --test_stream_data=crowd1080.yuv:1920:1080:1:crowd.mp4:4000000:30
117
118for the larger `crowd` file. These commands will put the encoded output into
119`bear.mp4` and `crowd.mp4` respectively. They can then be copied on the host and
120played with `mplayer -fps 25`.
121
122## Source code
123
124The VDAtest's source code can be consulted here: [https://cs.chromium.org/chromium/src/media/gpu/video_decode_accelerator_unittest.cc](https://cs.chromium.org/chromium/src/media/gpu/video_decode_accelerator_unittest.cc).
125
126V4L2 support: [https://cs.chromium.org/chromium/src/media/gpu/v4l2/](https://cs.chromium.org/chromium/src/media/gpu/v4l2/).
127
128VAAPI support: [https://cs.chromium.org/chromium/src/media/gpu/vaapi/](https://cs.chromium.org/chromium/src/media/gpu/vaapi/).