Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 1 | // Copyright 2014 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Alex Vakulenko | e36a981 | 2014-08-11 15:59:58 -0700 | [diff] [blame] | 4 | #ifndef AVTEST_LABEL_DETECT_LABEL_DETECT_H_ |
| 5 | #define AVTEST_LABEL_DETECT_LABEL_DETECT_H_ |
Hirokazu Honda | 491b168 | 2019-12-06 14:03:36 +0900 | [diff] [blame] | 6 | |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 7 | #include <stdbool.h> |
| 8 | #include <stdint.h> |
Hirokazu Honda | 491b168 | 2019-12-06 14:03:36 +0900 | [diff] [blame] | 9 | |
| 10 | #if defined(USE_V4L2_CODEC) |
| 11 | #include <linux/videodev2.h> |
| 12 | #endif // defined(USE_V4L2_CODEC) |
| 13 | |
Tom Hughes | 0e81695 | 2020-08-24 18:04:24 -0700 | [diff] [blame] | 14 | #if defined(USE_VAAPI) |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 15 | #include <va/va.h> |
Hirokazu Honda | 491b168 | 2019-12-06 14:03:36 +0900 | [diff] [blame] | 16 | #endif // defined (USE_VAAPI) |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 17 | |
| 18 | /* main.c */ |
| 19 | extern int verbose; |
Tom Hughes | 0e81695 | 2020-08-24 18:04:24 -0700 | [diff] [blame] | 20 | #define TRACE(...) \ |
| 21 | do { \ |
| 22 | if (verbose) \ |
| 23 | printf(__VA_ARGS__); \ |
| 24 | } while (0) |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 25 | |
Kuang-che Wu | 6b5559a | 2016-06-23 10:07:59 +0800 | [diff] [blame] | 26 | /* table_lookup.c */ |
| 27 | extern void detect_label_by_board_name(void); |
| 28 | |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 29 | /* util.c */ |
| 30 | extern int do_ioctl(int fd, int request, void* arg); |
Kuang-che Wu | ca2bd58 | 2014-07-22 18:24:45 +0800 | [diff] [blame] | 31 | extern bool is_any_device(const char* pattern, bool (*func)(int fd)); |
Keiichi Watanabe | aea439c | 2019-03-22 22:56:51 +0900 | [diff] [blame] | 32 | extern bool is_any_device_with_path(const char* pattern, |
Tom Hughes | 0e81695 | 2020-08-24 18:04:24 -0700 | [diff] [blame] | 33 | bool (*func)(const char* dev_path, int fd)); |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 34 | extern void convert_fourcc_to_str(uint32_t fourcc, char* str); |
| 35 | |
| 36 | /* util_v4l2 */ |
Hirokazu Honda | 491b168 | 2019-12-06 14:03:36 +0900 | [diff] [blame] | 37 | #if defined(USE_V4L2_CODEC) |
Tom Hughes | 0e81695 | 2020-08-24 18:04:24 -0700 | [diff] [blame] | 38 | extern bool is_v4l2_support_format(int fd, |
| 39 | enum v4l2_buf_type buf_type, |
| 40 | uint32_t fourcc); |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 41 | extern bool is_hw_video_acc_device(int fd); |
henryhsu | 5c4b664 | 2015-08-13 14:15:00 +0800 | [diff] [blame] | 42 | extern bool is_hw_jpeg_acc_device(int fd); |
Tom Hughes | 0e81695 | 2020-08-24 18:04:24 -0700 | [diff] [blame] | 43 | bool get_v4l2_max_resolution(int fd, |
| 44 | uint32_t fourcc, |
| 45 | int32_t* const resolution_width, |
| 46 | int32_t* const resolution_height); |
Hirokazu Honda | 491b168 | 2019-12-06 14:03:36 +0900 | [diff] [blame] | 47 | #endif // defined(USE_V4L2_CODEC) |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 48 | |
| 49 | /* util_vaapi */ |
Hirokazu Honda | 491b168 | 2019-12-06 14:03:36 +0900 | [diff] [blame] | 50 | #if defined(USE_VAAPI) |
Tom Hughes | 0e81695 | 2020-08-24 18:04:24 -0700 | [diff] [blame] | 51 | bool is_vaapi_support_formats(int fd, |
| 52 | const VAProfile* profiles, |
| 53 | VAEntrypoint entrypoint, |
| 54 | unsigned int format); |
| 55 | bool get_vaapi_max_resolution(int fd, |
| 56 | const VAProfile* profiles, |
Steve Cho | 7978486 | 2021-01-22 13:59:00 -0800 | [diff] [blame] | 57 | VAEntrypoint entrypoint, |
| 58 | unsigned int format, |
Tom Hughes | 0e81695 | 2020-08-24 18:04:24 -0700 | [diff] [blame] | 59 | int32_t* const resolution_width, |
| 60 | int32_t* const resolution_height); |
Jeffrey Kardatzke | 819314a | 2021-03-01 17:10:32 -0800 | [diff] [blame] | 61 | bool are_vaapi_attribs_supported(int fd, |
| 62 | VAProfile va_profile, |
| 63 | VAEntrypoint entrypoint, |
| 64 | const VAConfigAttrib* required_attribs, |
| 65 | int num_required_attribs); |
Hirokazu Honda | 491b168 | 2019-12-06 14:03:36 +0900 | [diff] [blame] | 66 | #endif // defined(USE_VAAPI) |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 67 | |
| 68 | /* detectors */ |
Keiichi Watanabe | aea439c | 2019-03-22 22:56:51 +0900 | [diff] [blame] | 69 | extern bool detect_builtin_usb_camera(void); |
| 70 | extern bool detect_builtin_mipi_camera(void); |
| 71 | extern bool detect_vivid_camera(void); |
| 72 | extern bool detect_builtin_camera(void); |
| 73 | extern bool detect_builtin_or_vivid_camera(void); |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 74 | extern bool detect_video_acc_h264(void); |
| 75 | extern bool detect_video_acc_vp8(void); |
Kuang-che Wu | d477fae | 2015-03-09 21:03:21 +0800 | [diff] [blame] | 76 | extern bool detect_video_acc_vp9(void); |
Miguel Casas | 6936849 | 2017-11-29 17:49:46 -0500 | [diff] [blame] | 77 | extern bool detect_video_acc_vp9_2(void); |
Steve Cho | 7978486 | 2021-01-22 13:59:00 -0800 | [diff] [blame] | 78 | extern bool detect_video_acc_av1(void); |
| 79 | extern bool detect_video_acc_av1_10bpp(void); |
Jeffrey Kardatzke | eab7cc0 | 2021-02-24 12:53:14 -0800 | [diff] [blame] | 80 | extern bool detect_video_acc_hevc(void); |
| 81 | extern bool detect_video_acc_hevc_10bpp(void); |
Kuang-che Wu | db9c20b | 2014-04-17 16:14:18 +0800 | [diff] [blame] | 82 | extern bool detect_video_acc_enc_h264(void); |
| 83 | extern bool detect_video_acc_enc_vp8(void); |
Hirokazu Honda | d752e4e | 2019-02-10 20:53:56 +0900 | [diff] [blame] | 84 | extern bool detect_video_acc_enc_vp9(void); |
henryhsu | 5c4b664 | 2015-08-13 14:15:00 +0800 | [diff] [blame] | 85 | extern bool detect_jpeg_acc_dec(void); |
Sheng-Hao Tsao | ef33e4e | 2018-01-26 17:37:57 +0800 | [diff] [blame] | 86 | extern bool detect_jpeg_acc_enc(void); |
Hirokazu Honda | b0328c3 | 2017-10-02 13:18:37 +0900 | [diff] [blame] | 87 | bool detect_4k_device_h264(void); |
| 88 | bool detect_4k_device_vp8(void); |
| 89 | bool detect_4k_device_vp9(void); |
Steve Cho | 7978486 | 2021-01-22 13:59:00 -0800 | [diff] [blame] | 90 | bool detect_4k_device_av1(void); |
| 91 | bool detect_4k_device_av1_10bpp(void); |
Jeffrey Kardatzke | eab7cc0 | 2021-02-24 12:53:14 -0800 | [diff] [blame] | 92 | bool detect_4k_device_hevc(void); |
| 93 | bool detect_4k_device_hevc_10bpp(void); |
Pin-chih Lin | 5195fe1 | 2019-03-06 21:20:15 +0800 | [diff] [blame] | 94 | bool detect_4k_device_enc_h264(void); |
| 95 | bool detect_4k_device_enc_vp8(void); |
| 96 | bool detect_4k_device_enc_vp9(void); |
Jeffrey Kardatzke | 819314a | 2021-03-01 17:10:32 -0800 | [diff] [blame] | 97 | bool detect_video_prot_cencv1_h264_cbc(void); |
| 98 | bool detect_video_prot_cencv1_h264_ctr(void); |
| 99 | bool detect_video_prot_cencv3_av1_cbc(void); |
| 100 | bool detect_video_prot_cencv3_av1_ctr(void); |
| 101 | bool detect_video_prot_cencv3_h264_cbc(void); |
| 102 | bool detect_video_prot_cencv3_h264_ctr(void); |
| 103 | bool detect_video_prot_cencv3_hevc_cbc(void); |
| 104 | bool detect_video_prot_cencv3_hevc_ctr(void); |
| 105 | bool detect_video_prot_cencv3_vp9_cbc(void); |
| 106 | bool detect_video_prot_cencv3_vp9_ctr(void); |
Alex Vakulenko | e36a981 | 2014-08-11 15:59:58 -0700 | [diff] [blame] | 107 | #endif // AVTEST_LABEL_DETECT_LABEL_DETECT_H_ |