From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/2] lib/igt_infoframe: add support for AVI InfoFrames
Date: Mon, 22 Jul 2019 18:01:26 +0300 [thread overview]
Message-ID: <20190722150127.3357-2-simon.ser@intel.com> (raw)
In-Reply-To: <20190722150127.3357-1-simon.ser@intel.com>
This commit adds partial support for AVI InfoFrames. Only bytes 1 and 2 of the
InfoFrame payload are parsed.
These bytes contain (among other things) information about the aspect ratio of
the frames.
Signed-off-by: Simon Ser <simon.ser@intel.com>
---
lib/igt_infoframe.c | 30 ++++++++++++++++++++++++++++
lib/igt_infoframe.h | 48 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+)
diff --git a/lib/igt_infoframe.c b/lib/igt_infoframe.c
index 7e4fb45881a6..d8a2e609573c 100644
--- a/lib/igt_infoframe.c
+++ b/lib/igt_infoframe.c
@@ -27,6 +27,7 @@
#include <string.h>
+#include "igt_core.h"
#include "igt_infoframe.h"
/**
@@ -61,6 +62,35 @@ static const int sample_sizes[] = {
static const size_t sample_sizes_len = sizeof(sample_sizes) / sizeof(sample_sizes[0]);
+bool infoframe_avi_parse(struct infoframe_avi *infoframe, int version,
+ const uint8_t *buf, size_t buf_size)
+{
+ memset(infoframe, 0, sizeof(*infoframe));
+
+ switch (version) {
+ case 2:
+ case 3:
+ case 4:
+ break; /* supported */
+ default:
+ igt_debug("Unsuppported AVI InfoFrame version: %d\n", version);
+ return false;
+ }
+
+ if (buf_size < 13)
+ return false;
+
+ infoframe->rgb_ycbcr = buf[0] >> 5;
+ infoframe->scan = buf[0] & 0x3;
+
+ infoframe->colorimetry = buf[1] >> 7;
+ infoframe->picture_aspect_ratio = (buf[1] >> 4) & 0x3;
+ infoframe->active_aspect_ratio = buf[1] & 0xF;
+ infoframe->vic = buf[3];
+
+ return true;
+}
+
bool infoframe_audio_parse(struct infoframe_audio *infoframe, int version,
const uint8_t *buf, size_t buf_size)
{
diff --git a/lib/igt_infoframe.h b/lib/igt_infoframe.h
index 35daa3ea169d..056cdad6072a 100644
--- a/lib/igt_infoframe.h
+++ b/lib/igt_infoframe.h
@@ -32,6 +32,52 @@
#include <stddef.h>
#include <stdint.h>
+enum infoframe_avi_rgb_ycbcr {
+ INFOFRAME_AVI_RGB = 0,
+ INFOFRAME_AVI_YCBCR422 = 1,
+ INFOFRAME_AVI_YCBCR444 = 2,
+ INFOFRAME_AVI_YCBCR420 = 3,
+ INFOFRAME_AVI_IDO_DEFINED = 7,
+};
+
+enum infoframe_avi_scan {
+ INFOFRAME_AVI_SCAN_UNSPECIFIED = 0,
+ INFOFRAME_AVI_OVERSCAN = 1,
+ INFOFRAME_AVI_UNDERSCAN = 2,
+};
+
+enum infoframe_avi_colorimetry {
+ INFOFRAME_AVI_COLORIMETRY_UNSPECIFIED = 0,
+ INFOFRAME_AVI_SMPTE_170M = 1,
+ INFOFRAME_AVI_ITUR_BT709 = 2,
+ INFOFRAME_AVI_COLORIMETRY_EXTENDED = 3,
+};
+
+enum infoframe_avi_picture_aspect_ratio {
+ INFOFRAME_AVI_PIC_AR_UNSPECIFIED = 0,
+ INFOFRAME_AVI_PIC_AR_4_3 = 1,
+ INFOFRAME_AVI_PIC_AR_16_9 = 2,
+};
+
+enum infoframe_avi_active_aspect_ratio {
+ INFOFRAME_AVI_ACT_AR_PIC = 0, /* same as picture aspect ratio */
+ INFOFRAME_AVI_ACT_AR_4_3 = 9,
+ INFOFRAME_AVI_ACT_AR_16_9 = 10,
+ INFOFRAME_AVI_ACT_AR_14_9 = 11,
+};
+
+#define INFOFRAME_AVI_VIC_UNSPECIFIED 0
+
+struct infoframe_avi {
+ enum infoframe_avi_rgb_ycbcr rgb_ycbcr;
+ enum infoframe_avi_scan scan;
+ enum infoframe_avi_colorimetry colorimetry;
+ enum infoframe_avi_picture_aspect_ratio picture_aspect_ratio;
+ enum infoframe_avi_active_aspect_ratio active_aspect_ratio;
+ uint8_t vic; /* Video Identification Code */
+ /* TODO: remaining fields */
+};
+
enum infoframe_audio_coding_type {
INFOFRAME_AUDIO_CT_UNSPECIFIED = 0, /* refer to stream header */
INFOFRAME_AUDIO_CT_PCM = 1, /* IEC 60958 PCM */
@@ -58,6 +104,8 @@ struct infoframe_audio {
/* TODO: speaker allocation */
};
+bool infoframe_avi_parse(struct infoframe_avi *infoframe, int version,
+ const uint8_t *buf, size_t buf_size);
bool infoframe_audio_parse(struct infoframe_audio *infoframe, int version,
const uint8_t *buf, size_t buf_size);
--
2.22.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-07-22 15:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 15:01 [igt-dev] [PATCH i-g-t 0/2] Add an HDMI aspect ratio test Simon Ser
2019-07-22 15:01 ` Simon Ser [this message]
2019-08-15 11:30 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_infoframe: add support for AVI InfoFrames Arkadiusz Hiler
2019-08-15 11:54 ` Ser, Simon
2019-07-22 15:01 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_chamelium: add an aspect ratio test Simon Ser
2019-08-15 12:21 ` Arkadiusz Hiler
2019-08-15 11:17 ` [igt-dev] ✓ Fi.CI.BAT: success for Add an HDMI aspect ratio test (rev2) Patchwork
2019-08-16 2:32 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190722150127.3357-2-simon.ser@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox