v4l2-tpg.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * v4l2-tpg.h - Test Pattern Generator
  4. *
  5. * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
  6. */
  7. #ifndef _V4L2_TPG_H_
  8. #define _V4L2_TPG_H_
  9. #include <linux/types.h>
  10. #include <linux/errno.h>
  11. #include <linux/random.h>
  12. #include <linux/slab.h>
  13. #include <linux/vmalloc.h>
  14. #include <linux/videodev2.h>
  15. struct tpg_rbg_color8 {
  16. unsigned char r, g, b;
  17. };
  18. struct tpg_rbg_color16 {
  19. __u16 r, g, b;
  20. };
  21. enum tpg_color {
  22. TPG_COLOR_CSC_WHITE,
  23. TPG_COLOR_CSC_YELLOW,
  24. TPG_COLOR_CSC_CYAN,
  25. TPG_COLOR_CSC_GREEN,
  26. TPG_COLOR_CSC_MAGENTA,
  27. TPG_COLOR_CSC_RED,
  28. TPG_COLOR_CSC_BLUE,
  29. TPG_COLOR_CSC_BLACK,
  30. TPG_COLOR_75_YELLOW,
  31. TPG_COLOR_75_CYAN,
  32. TPG_COLOR_75_GREEN,
  33. TPG_COLOR_75_MAGENTA,
  34. TPG_COLOR_75_RED,
  35. TPG_COLOR_75_BLUE,
  36. TPG_COLOR_100_WHITE,
  37. TPG_COLOR_100_YELLOW,
  38. TPG_COLOR_100_CYAN,
  39. TPG_COLOR_100_GREEN,
  40. TPG_COLOR_100_MAGENTA,
  41. TPG_COLOR_100_RED,
  42. TPG_COLOR_100_BLUE,
  43. TPG_COLOR_100_BLACK,
  44. TPG_COLOR_TEXTFG,
  45. TPG_COLOR_TEXTBG,
  46. TPG_COLOR_RANDOM,
  47. TPG_COLOR_RAMP,
  48. TPG_COLOR_MAX = TPG_COLOR_RAMP + 256
  49. };
  50. extern const struct tpg_rbg_color8 tpg_colors[TPG_COLOR_MAX];
  51. extern const unsigned short tpg_rec709_to_linear[255 * 16 + 1];
  52. extern const unsigned short tpg_linear_to_rec709[255 * 16 + 1];
  53. extern const struct tpg_rbg_color16 tpg_csc_colors[V4L2_COLORSPACE_DCI_P3 + 1]
  54. [V4L2_XFER_FUNC_SMPTE2084 + 1]
  55. [TPG_COLOR_CSC_BLACK + 1];
  56. enum tpg_pattern {
  57. TPG_PAT_75_COLORBAR,
  58. TPG_PAT_100_COLORBAR,
  59. TPG_PAT_CSC_COLORBAR,
  60. TPG_PAT_100_HCOLORBAR,
  61. TPG_PAT_100_COLORSQUARES,
  62. TPG_PAT_BLACK,
  63. TPG_PAT_WHITE,
  64. TPG_PAT_RED,
  65. TPG_PAT_GREEN,
  66. TPG_PAT_BLUE,
  67. TPG_PAT_CHECKERS_16X16,
  68. TPG_PAT_CHECKERS_2X2,
  69. TPG_PAT_CHECKERS_1X1,
  70. TPG_PAT_COLOR_CHECKERS_2X2,
  71. TPG_PAT_COLOR_CHECKERS_1X1,
  72. TPG_PAT_ALTERNATING_HLINES,
  73. TPG_PAT_ALTERNATING_VLINES,
  74. TPG_PAT_CROSS_1_PIXEL,
  75. TPG_PAT_CROSS_2_PIXELS,
  76. TPG_PAT_CROSS_10_PIXELS,
  77. TPG_PAT_GRAY_RAMP,
  78. /* Must be the last pattern */
  79. TPG_PAT_NOISE,
  80. };
  81. extern const char * const tpg_pattern_strings[];
  82. enum tpg_quality {
  83. TPG_QUAL_COLOR,
  84. TPG_QUAL_GRAY,
  85. TPG_QUAL_NOISE
  86. };
  87. enum tpg_video_aspect {
  88. TPG_VIDEO_ASPECT_IMAGE,
  89. TPG_VIDEO_ASPECT_4X3,
  90. TPG_VIDEO_ASPECT_14X9_CENTRE,
  91. TPG_VIDEO_ASPECT_16X9_CENTRE,
  92. TPG_VIDEO_ASPECT_16X9_ANAMORPHIC,
  93. };
  94. enum tpg_pixel_aspect {
  95. TPG_PIXEL_ASPECT_SQUARE,
  96. TPG_PIXEL_ASPECT_NTSC,
  97. TPG_PIXEL_ASPECT_PAL,
  98. };
  99. enum tpg_move_mode {
  100. TPG_MOVE_NEG_FAST,
  101. TPG_MOVE_NEG,
  102. TPG_MOVE_NEG_SLOW,
  103. TPG_MOVE_NONE,
  104. TPG_MOVE_POS_SLOW,
  105. TPG_MOVE_POS,
  106. TPG_MOVE_POS_FAST,
  107. };
  108. enum tgp_color_enc {
  109. TGP_COLOR_ENC_RGB,
  110. TGP_COLOR_ENC_YCBCR,
  111. TGP_COLOR_ENC_HSV,
  112. TGP_COLOR_ENC_LUMA,
  113. };
  114. extern const char * const tpg_aspect_strings[];
  115. #define TPG_MAX_PLANES 3
  116. #define TPG_MAX_PAT_LINES 8
  117. struct tpg_data {
  118. /* Source frame size */
  119. unsigned src_width, src_height;
  120. /* Buffer height */
  121. unsigned buf_height;
  122. /* Scaled output frame size */
  123. unsigned scaled_width;
  124. u32 field;
  125. bool field_alternate;
  126. /* crop coordinates are frame-based */
  127. struct v4l2_rect crop;
  128. /* compose coordinates are format-based */
  129. struct v4l2_rect compose;
  130. /* border and square coordinates are frame-based */
  131. struct v4l2_rect border;
  132. struct v4l2_rect square;
  133. /* Color-related fields */
  134. enum tpg_quality qual;
  135. unsigned qual_offset;
  136. u8 alpha_component;
  137. bool alpha_red_only;
  138. u8 brightness;
  139. u8 contrast;
  140. u8 saturation;
  141. s16 hue;
  142. u32 fourcc;
  143. enum tgp_color_enc color_enc;
  144. u32 colorspace;
  145. u32 xfer_func;
  146. u32 ycbcr_enc;
  147. u32 hsv_enc;
  148. /*
  149. * Stores the actual transfer function, i.e. will never be
  150. * V4L2_XFER_FUNC_DEFAULT.
  151. */
  152. u32 real_xfer_func;
  153. /*
  154. * Stores the actual Y'CbCr encoding, i.e. will never be
  155. * V4L2_YCBCR_ENC_DEFAULT.
  156. */
  157. u32 real_hsv_enc;
  158. u32 real_ycbcr_enc;
  159. u32 quantization;
  160. /*
  161. * Stores the actual quantization, i.e. will never be
  162. * V4L2_QUANTIZATION_DEFAULT.
  163. */
  164. u32 real_quantization;
  165. enum tpg_video_aspect vid_aspect;
  166. enum tpg_pixel_aspect pix_aspect;
  167. unsigned rgb_range;
  168. unsigned real_rgb_range;
  169. unsigned buffers;
  170. unsigned planes;
  171. bool interleaved;
  172. u8 vdownsampling[TPG_MAX_PLANES];
  173. u8 hdownsampling[TPG_MAX_PLANES];
  174. /*
  175. * horizontal positions must be ANDed with this value to enforce
  176. * correct boundaries for packed YUYV values.
  177. */
  178. unsigned hmask[TPG_MAX_PLANES];
  179. /* Used to store the colors in native format, either RGB or YUV */
  180. u8 colors[TPG_COLOR_MAX][3];
  181. u8 textfg[TPG_MAX_PLANES][8], textbg[TPG_MAX_PLANES][8];
  182. /* size in bytes for two pixels in each plane */
  183. unsigned twopixelsize[TPG_MAX_PLANES];
  184. unsigned bytesperline[TPG_MAX_PLANES];
  185. /* Configuration */
  186. enum tpg_pattern pattern;
  187. bool hflip;
  188. bool vflip;
  189. unsigned perc_fill;
  190. bool perc_fill_blank;
  191. bool show_border;
  192. bool show_square;
  193. bool insert_sav;
  194. bool insert_eav;
  195. /* Test pattern movement */
  196. enum tpg_move_mode mv_hor_mode;
  197. int mv_hor_count;
  198. int mv_hor_step;
  199. enum tpg_move_mode mv_vert_mode;
  200. int mv_vert_count;
  201. int mv_vert_step;
  202. bool recalc_colors;
  203. bool recalc_lines;
  204. bool recalc_square_border;
  205. /* Used to store TPG_MAX_PAT_LINES lines, each with up to two planes */
  206. unsigned max_line_width;
  207. u8 *lines[TPG_MAX_PAT_LINES][TPG_MAX_PLANES];
  208. u8 *downsampled_lines[TPG_MAX_PAT_LINES][TPG_MAX_PLANES];
  209. u8 *random_line[TPG_MAX_PLANES];
  210. u8 *contrast_line[TPG_MAX_PLANES];
  211. u8 *black_line[TPG_MAX_PLANES];
  212. };
  213. void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h);
  214. int tpg_alloc(struct tpg_data *tpg, unsigned max_w);
  215. void tpg_free(struct tpg_data *tpg);
  216. void tpg_reset_source(struct tpg_data *tpg, unsigned width, unsigned height,
  217. u32 field);
  218. void tpg_log_status(struct tpg_data *tpg);
  219. void tpg_set_font(const u8 *f);
  220. void tpg_gen_text(const struct tpg_data *tpg,
  221. u8 *basep[TPG_MAX_PLANES][2], int y, int x, char *text);
  222. void tpg_calc_text_basep(struct tpg_data *tpg,
  223. u8 *basep[TPG_MAX_PLANES][2], unsigned p, u8 *vbuf);
  224. unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line);
  225. void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
  226. unsigned p, u8 *vbuf);
  227. void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std,
  228. unsigned p, u8 *vbuf);
  229. bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc);
  230. void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
  231. const struct v4l2_rect *compose);
  232. static inline void tpg_s_pattern(struct tpg_data *tpg, enum tpg_pattern pattern)
  233. {
  234. if (tpg->pattern == pattern)
  235. return;
  236. tpg->pattern = pattern;
  237. tpg->recalc_colors = true;
  238. }
  239. static inline void tpg_s_quality(struct tpg_data *tpg,
  240. enum tpg_quality qual, unsigned qual_offset)
  241. {
  242. if (tpg->qual == qual && tpg->qual_offset == qual_offset)
  243. return;
  244. tpg->qual = qual;
  245. tpg->qual_offset = qual_offset;
  246. tpg->recalc_colors = true;
  247. }
  248. static inline enum tpg_quality tpg_g_quality(const struct tpg_data *tpg)
  249. {
  250. return tpg->qual;
  251. }
  252. static inline void tpg_s_alpha_component(struct tpg_data *tpg,
  253. u8 alpha_component)
  254. {
  255. if (tpg->alpha_component == alpha_component)
  256. return;
  257. tpg->alpha_component = alpha_component;
  258. tpg->recalc_colors = true;
  259. }
  260. static inline void tpg_s_alpha_mode(struct tpg_data *tpg,
  261. bool red_only)
  262. {
  263. if (tpg->alpha_red_only == red_only)
  264. return;
  265. tpg->alpha_red_only = red_only;
  266. tpg->recalc_colors = true;
  267. }
  268. static inline void tpg_s_brightness(struct tpg_data *tpg,
  269. u8 brightness)
  270. {
  271. if (tpg->brightness == brightness)
  272. return;
  273. tpg->brightness = brightness;
  274. tpg->recalc_colors = true;
  275. }
  276. static inline void tpg_s_contrast(struct tpg_data *tpg,
  277. u8 contrast)
  278. {
  279. if (tpg->contrast == contrast)
  280. return;
  281. tpg->contrast = contrast;
  282. tpg->recalc_colors = true;
  283. }
  284. static inline void tpg_s_saturation(struct tpg_data *tpg,
  285. u8 saturation)
  286. {
  287. if (tpg->saturation == saturation)
  288. return;
  289. tpg->saturation = saturation;
  290. tpg->recalc_colors = true;
  291. }
  292. static inline void tpg_s_hue(struct tpg_data *tpg,
  293. s16 hue)
  294. {
  295. if (tpg->hue == hue)
  296. return;
  297. tpg->hue = hue;
  298. tpg->recalc_colors = true;
  299. }
  300. static inline void tpg_s_rgb_range(struct tpg_data *tpg,
  301. unsigned rgb_range)
  302. {
  303. if (tpg->rgb_range == rgb_range)
  304. return;
  305. tpg->rgb_range = rgb_range;
  306. tpg->recalc_colors = true;
  307. }
  308. static inline void tpg_s_real_rgb_range(struct tpg_data *tpg,
  309. unsigned rgb_range)
  310. {
  311. if (tpg->real_rgb_range == rgb_range)
  312. return;
  313. tpg->real_rgb_range = rgb_range;
  314. tpg->recalc_colors = true;
  315. }
  316. static inline void tpg_s_colorspace(struct tpg_data *tpg, u32 colorspace)
  317. {
  318. if (tpg->colorspace == colorspace)
  319. return;
  320. tpg->colorspace = colorspace;
  321. tpg->recalc_colors = true;
  322. }
  323. static inline u32 tpg_g_colorspace(const struct tpg_data *tpg)
  324. {
  325. return tpg->colorspace;
  326. }
  327. static inline void tpg_s_ycbcr_enc(struct tpg_data *tpg, u32 ycbcr_enc)
  328. {
  329. if (tpg->ycbcr_enc == ycbcr_enc)
  330. return;
  331. tpg->ycbcr_enc = ycbcr_enc;
  332. tpg->recalc_colors = true;
  333. }
  334. static inline u32 tpg_g_ycbcr_enc(const struct tpg_data *tpg)
  335. {
  336. return tpg->ycbcr_enc;
  337. }
  338. static inline void tpg_s_hsv_enc(struct tpg_data *tpg, u32 hsv_enc)
  339. {
  340. if (tpg->hsv_enc == hsv_enc)
  341. return;
  342. tpg->hsv_enc = hsv_enc;
  343. tpg->recalc_colors = true;
  344. }
  345. static inline u32 tpg_g_hsv_enc(const struct tpg_data *tpg)
  346. {
  347. return tpg->hsv_enc;
  348. }
  349. static inline void tpg_s_xfer_func(struct tpg_data *tpg, u32 xfer_func)
  350. {
  351. if (tpg->xfer_func == xfer_func)
  352. return;
  353. tpg->xfer_func = xfer_func;
  354. tpg->recalc_colors = true;
  355. }
  356. static inline u32 tpg_g_xfer_func(const struct tpg_data *tpg)
  357. {
  358. return tpg->xfer_func;
  359. }
  360. static inline void tpg_s_quantization(struct tpg_data *tpg, u32 quantization)
  361. {
  362. if (tpg->quantization == quantization)
  363. return;
  364. tpg->quantization = quantization;
  365. tpg->recalc_colors = true;
  366. }
  367. static inline u32 tpg_g_quantization(const struct tpg_data *tpg)
  368. {
  369. return tpg->quantization;
  370. }
  371. static inline unsigned tpg_g_buffers(const struct tpg_data *tpg)
  372. {
  373. return tpg->buffers;
  374. }
  375. static inline unsigned tpg_g_planes(const struct tpg_data *tpg)
  376. {
  377. return tpg->interleaved ? 1 : tpg->planes;
  378. }
  379. static inline bool tpg_g_interleaved(const struct tpg_data *tpg)
  380. {
  381. return tpg->interleaved;
  382. }
  383. static inline unsigned tpg_g_twopixelsize(const struct tpg_data *tpg, unsigned plane)
  384. {
  385. return tpg->twopixelsize[plane];
  386. }
  387. static inline unsigned tpg_hdiv(const struct tpg_data *tpg,
  388. unsigned plane, unsigned x)
  389. {
  390. return ((x / tpg->hdownsampling[plane]) & tpg->hmask[plane]) *
  391. tpg->twopixelsize[plane] / 2;
  392. }
  393. static inline unsigned tpg_hscale(const struct tpg_data *tpg, unsigned x)
  394. {
  395. return (x * tpg->scaled_width) / tpg->src_width;
  396. }
  397. static inline unsigned tpg_hscale_div(const struct tpg_data *tpg,
  398. unsigned plane, unsigned x)
  399. {
  400. return tpg_hdiv(tpg, plane, tpg_hscale(tpg, x));
  401. }
  402. static inline unsigned tpg_g_bytesperline(const struct tpg_data *tpg, unsigned plane)
  403. {
  404. return tpg->bytesperline[plane];
  405. }
  406. static inline void tpg_s_bytesperline(struct tpg_data *tpg, unsigned plane, unsigned bpl)
  407. {
  408. unsigned p;
  409. if (tpg->buffers > 1) {
  410. tpg->bytesperline[plane] = bpl;
  411. return;
  412. }
  413. for (p = 0; p < tpg_g_planes(tpg); p++) {
  414. unsigned plane_w = bpl * tpg->twopixelsize[p] / tpg->twopixelsize[0];
  415. tpg->bytesperline[p] = plane_w / tpg->hdownsampling[p];
  416. }
  417. if (tpg_g_interleaved(tpg))
  418. tpg->bytesperline[1] = tpg->bytesperline[0];
  419. }
  420. static inline unsigned tpg_g_line_width(const struct tpg_data *tpg, unsigned plane)
  421. {
  422. unsigned w = 0;
  423. unsigned p;
  424. if (tpg->buffers > 1)
  425. return tpg_g_bytesperline(tpg, plane);
  426. for (p = 0; p < tpg_g_planes(tpg); p++) {
  427. unsigned plane_w = tpg_g_bytesperline(tpg, p);
  428. w += plane_w / tpg->vdownsampling[p];
  429. }
  430. return w;
  431. }
  432. static inline unsigned tpg_calc_line_width(const struct tpg_data *tpg,
  433. unsigned plane, unsigned bpl)
  434. {
  435. unsigned w = 0;
  436. unsigned p;
  437. if (tpg->buffers > 1)
  438. return bpl;
  439. for (p = 0; p < tpg_g_planes(tpg); p++) {
  440. unsigned plane_w = bpl * tpg->twopixelsize[p] / tpg->twopixelsize[0];
  441. plane_w /= tpg->hdownsampling[p];
  442. w += plane_w / tpg->vdownsampling[p];
  443. }
  444. return w;
  445. }
  446. static inline unsigned tpg_calc_plane_size(const struct tpg_data *tpg, unsigned plane)
  447. {
  448. if (plane >= tpg_g_planes(tpg))
  449. return 0;
  450. return tpg_g_bytesperline(tpg, plane) * tpg->buf_height /
  451. tpg->vdownsampling[plane];
  452. }
  453. static inline void tpg_s_buf_height(struct tpg_data *tpg, unsigned h)
  454. {
  455. tpg->buf_height = h;
  456. }
  457. static inline void tpg_s_field(struct tpg_data *tpg, unsigned field, bool alternate)
  458. {
  459. tpg->field = field;
  460. tpg->field_alternate = alternate;
  461. }
  462. static inline void tpg_s_perc_fill(struct tpg_data *tpg,
  463. unsigned perc_fill)
  464. {
  465. tpg->perc_fill = perc_fill;
  466. }
  467. static inline unsigned tpg_g_perc_fill(const struct tpg_data *tpg)
  468. {
  469. return tpg->perc_fill;
  470. }
  471. static inline void tpg_s_perc_fill_blank(struct tpg_data *tpg,
  472. bool perc_fill_blank)
  473. {
  474. tpg->perc_fill_blank = perc_fill_blank;
  475. }
  476. static inline void tpg_s_video_aspect(struct tpg_data *tpg,
  477. enum tpg_video_aspect vid_aspect)
  478. {
  479. if (tpg->vid_aspect == vid_aspect)
  480. return;
  481. tpg->vid_aspect = vid_aspect;
  482. tpg->recalc_square_border = true;
  483. }
  484. static inline enum tpg_video_aspect tpg_g_video_aspect(const struct tpg_data *tpg)
  485. {
  486. return tpg->vid_aspect;
  487. }
  488. static inline void tpg_s_pixel_aspect(struct tpg_data *tpg,
  489. enum tpg_pixel_aspect pix_aspect)
  490. {
  491. if (tpg->pix_aspect == pix_aspect)
  492. return;
  493. tpg->pix_aspect = pix_aspect;
  494. tpg->recalc_square_border = true;
  495. }
  496. static inline void tpg_s_show_border(struct tpg_data *tpg,
  497. bool show_border)
  498. {
  499. tpg->show_border = show_border;
  500. }
  501. static inline void tpg_s_show_square(struct tpg_data *tpg,
  502. bool show_square)
  503. {
  504. tpg->show_square = show_square;
  505. }
  506. static inline void tpg_s_insert_sav(struct tpg_data *tpg, bool insert_sav)
  507. {
  508. tpg->insert_sav = insert_sav;
  509. }
  510. static inline void tpg_s_insert_eav(struct tpg_data *tpg, bool insert_eav)
  511. {
  512. tpg->insert_eav = insert_eav;
  513. }
  514. void tpg_update_mv_step(struct tpg_data *tpg);
  515. static inline void tpg_s_mv_hor_mode(struct tpg_data *tpg,
  516. enum tpg_move_mode mv_hor_mode)
  517. {
  518. tpg->mv_hor_mode = mv_hor_mode;
  519. tpg_update_mv_step(tpg);
  520. }
  521. static inline void tpg_s_mv_vert_mode(struct tpg_data *tpg,
  522. enum tpg_move_mode mv_vert_mode)
  523. {
  524. tpg->mv_vert_mode = mv_vert_mode;
  525. tpg_update_mv_step(tpg);
  526. }
  527. static inline void tpg_init_mv_count(struct tpg_data *tpg)
  528. {
  529. tpg->mv_hor_count = tpg->mv_vert_count = 0;
  530. }
  531. static inline void tpg_update_mv_count(struct tpg_data *tpg, bool frame_is_field)
  532. {
  533. tpg->mv_hor_count += tpg->mv_hor_step * (frame_is_field ? 1 : 2);
  534. tpg->mv_vert_count += tpg->mv_vert_step * (frame_is_field ? 1 : 2);
  535. }
  536. static inline void tpg_s_hflip(struct tpg_data *tpg, bool hflip)
  537. {
  538. if (tpg->hflip == hflip)
  539. return;
  540. tpg->hflip = hflip;
  541. tpg_update_mv_step(tpg);
  542. tpg->recalc_lines = true;
  543. }
  544. static inline bool tpg_g_hflip(const struct tpg_data *tpg)
  545. {
  546. return tpg->hflip;
  547. }
  548. static inline void tpg_s_vflip(struct tpg_data *tpg, bool vflip)
  549. {
  550. tpg->vflip = vflip;
  551. }
  552. static inline bool tpg_g_vflip(const struct tpg_data *tpg)
  553. {
  554. return tpg->vflip;
  555. }
  556. static inline bool tpg_pattern_is_static(const struct tpg_data *tpg)
  557. {
  558. return tpg->pattern != TPG_PAT_NOISE &&
  559. tpg->mv_hor_mode == TPG_MOVE_NONE &&
  560. tpg->mv_vert_mode == TPG_MOVE_NONE;
  561. }
  562. #endif