blob: 464db23f4123d1250f6987b98f705e8217522431 [file] [log] [blame] [view]
David Staessens4f4910872019-10-28 03:18:511# Using the Video Encode Accelerator Unittests Manually
2
3The VEAtest (or `video_encode_accelerator_unittest`) is a set of unit tests that
4embeds the Chrome video encoding stack without requiring the whole browser,
5meaning they can work in a headless environment. It includes a variety of tests
6to validate the encoding stack with h264, vp8 and vp9.
7
8Running this test manually can be very useful when bringing up a new codec, or
9in order to make sure that new code does not break hardware encoding. This
10document is a walk though the prerequisites for running this program, as well
11as the most common options.
12
13## Prerequisites
14
15The required kernel drivers should be loaded, and there should exist a
16`/dev/video-enc0` symbolic link pointing to the encoder device node (e.g.
17`/dev/video-enc0` `/dev/video0`).
18
19The unittests can be built by specifying the `video_encode_accelerator_unittest`
20target to `ninja`. If you are building for an ARM board that is not yet
21supported by the
22[simplechrome](https://chromium.googlesource.com/chromiumos/docs/+/master/simple_chrome_workflow.md)
23workflow, use `arm-generic` as the board. It should work across all ARM targets.
24
25For unlisted Intel boards, any other Intel target (preferably with the same
26chipset) should be usable with libva. AMD targets can use `amd64-generic`.
27
28## Basic VEA usage
29
30The VEA test takes raw YUV files in I420 format as input and produces e.g. an
31H.264 Annex-B byte stream. Sample raw YUV files can be found at the following
32locations:
33
34* [1080 Crowd YUV](http://commondatastorage.googleapis.com/chromiumos-test-assets-public/crowd/crowd1080-96f60dd6ff87ba8b129301a0f36efc58.yuv)
35* [320x180 Bear YUV](http://commondatastorage.googleapis.com/chromiumos-test-assets-public/bear/bear-320x180-c60a86c52ba93fa7c5ae4bb3156dfc2a.yuv)
36
37It is recommended to rename these files after downloading them to e.g.
38`crowd1080.yuv` and `bear-320x180.yuv`.
39
40The VEA can then be tested as follows:
41
42 ./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
43
44for the `bear` file, and
45
46 ./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
47
48for the larger `crowd` file. These commands will put the encoded output into
49`bear.mp4` and `crowd.mp4` respectively. They can then be copied on the host and
50played with `mplayer -fps 25`.
51
52## Test filtering options
53
54`./video_encode_accelerator_unittest --help` will list all valid options.
55
56The list of available tests can be retrieved using the `--gtest_list_tests`
57option.
58
59By default, all tests are run, which can be a bit too much, especially when
60bringing up a new codec. The `--gtest_filter` option can be used to specify a
61pattern of test names to run.
62
63## Verbosity options
64
65The `--vmodule` options allows to specify a set of source files that should be
66more verbose about what they are doing. For basic usage, a useful set of vmodule
67options could be:
68
69 --vmodule=*/media/gpu/*=4
70
71## Source code
72
73The VEAtest's source code can be consulted here: [https://cs.chromium.org/chromium/src/media/gpu/video_encode_accelerator_unittest.cc](https://cs.chromium.org/chromium/src/media/gpu/video_encode_accelerator_unittest.cc).
74
75V4L2 support: [https://cs.chromium.org/chromium/src/media/gpu/v4l2/](https://cs.chromium.org/chromium/src/media/gpu/v4l2/).
76
77VAAPI support: [https://cs.chromium.org/chromium/src/media/gpu/vaapi/](https://cs.chromium.org/chromium/src/media/gpu/vaapi/).