aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-30 12:14:44 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-30 12:14:44 +0200
commit5edb8a1a20eba27720b5cec98969e27a5954b0d9 (patch)
treea404c84c34e8eb48edb0eda8321b7d9d3a7ca4c8
parent94edff4a27fe3773aabff37213595445ae0a4cdb (diff)
edid-decode: split off SVR parsing into cta_print_svr()
This makes it easier in the future to re-use the SVR parsing and checking code. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--edid-decode.h1
-rw-r--r--parse-cta-block.cpp99
2 files changed, 52 insertions, 48 deletions
diff --git a/edid-decode.h b/edid-decode.h
index 6a40092..738c95f 100644
--- a/edid-decode.h
+++ b/edid-decode.h
@@ -343,6 +343,7 @@ struct edid_state {
void cta_vcdb(const unsigned char *x, unsigned length);
void cta_svd(const unsigned char *x, unsigned n, bool for_ycbcr420);
void cta_y420cmdb(const unsigned char *x, unsigned length);
+ void cta_print_svr(unsigned char svr, vec_timings_ext &vec_tim);
void cta_vfpdb(const unsigned char *x, unsigned length);
void cta_rcdb(const unsigned char *x, unsigned length);
void cta_sldb(const unsigned char *x, unsigned length);
diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index 0301036..7b3f0c3 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -547,6 +547,55 @@ void edid_state::cta_y420cmdb(const unsigned char *x, unsigned length)
max_idx + 1, cta.preparsed_svds[0].size());
}
+void edid_state::cta_print_svr(unsigned char svr, vec_timings_ext &vec_tim)
+{
+ char suffix[16];
+
+ if ((svr > 0 && svr < 128) || (svr > 192 && svr < 254)) {
+ const struct timings *t;
+ unsigned char vic = svr;
+
+ sprintf(suffix, "VIC %3u", vic);
+
+ t = find_vic_id(vic);
+ if (t) {
+ print_timings(" ", t, suffix);
+ vec_tim.push_back(timings_ext(*t, suffix, ""));
+ } else {
+ printf(" %s: Unknown\n", suffix);
+ fail("Unknown VIC %u.\n", vic);
+ }
+
+ } else if (svr >= 129 && svr <= 144) {
+ sprintf(suffix, "DTD %3u", svr - 128);
+ if (svr >= cta.preparsed_total_dtds + 129) {
+ printf(" %s: Invalid\n", suffix);
+ fail("Invalid DTD %u.\n", svr - 128);
+ } else {
+ printf(" %s\n", suffix);
+ vec_tim.push_back(timings_ext(svr, suffix));
+ }
+ } else if (svr >= 145 && svr <= 160) {
+ sprintf(suffix, "VTDB %3u", svr - 144);
+ if (svr >= cta.preparsed_total_vtdbs + 145) {
+ printf(" %s: Invalid\n", suffix);
+ fail("Invalid VTDB %u.\n", svr - 144);
+ } else {
+ printf(" %s\n", suffix);
+ vec_tim.push_back(timings_ext(svr, suffix));
+ }
+ } else if (svr == 254) {
+ sprintf(suffix, "T8VTDB");
+ if (!cta.preparsed_has_t8vtdb) {
+ printf(" %s: Invalid\n", suffix);
+ fail("Invalid T8VTDB.\n");
+ } else {
+ printf(" %s\n", suffix);
+ vec_tim.push_back(timings_ext(svr, suffix));
+ }
+ }
+}
+
void edid_state::cta_vfpdb(const unsigned char *x, unsigned length)
{
unsigned i;
@@ -556,54 +605,8 @@ void edid_state::cta_vfpdb(const unsigned char *x, unsigned length)
return;
}
cta.preferred_timings.clear();
- for (i = 0; i < length; i++) {
- unsigned char svr = x[i];
- char suffix[16];
-
- if ((svr > 0 && svr < 128) || (svr > 192 && svr < 254)) {
- const struct timings *t;
- unsigned char vic = svr;
-
- sprintf(suffix, "VIC %3u", vic);
-
- t = find_vic_id(vic);
- if (t) {
- print_timings(" ", t, suffix);
- cta.preferred_timings.push_back(timings_ext(*t, suffix, ""));
- } else {
- printf(" %s: Unknown\n", suffix);
- fail("Unknown VIC %u.\n", vic);
- }
-
- } else if (svr >= 129 && svr <= 144) {
- sprintf(suffix, "DTD %3u", svr - 128);
- if (svr >= cta.preparsed_total_dtds + 129) {
- printf(" %s: Invalid\n", suffix);
- fail("Invalid DTD %u.\n", svr - 128);
- } else {
- printf(" %s\n", suffix);
- cta.preferred_timings.push_back(timings_ext(svr, suffix));
- }
- } else if (svr >= 145 && svr <= 160) {
- sprintf(suffix, "VTDB %3u", svr - 144);
- if (svr >= cta.preparsed_total_vtdbs + 145) {
- printf(" %s: Invalid\n", suffix);
- fail("Invalid VTDB %u.\n", svr - 144);
- } else {
- printf(" %s\n", suffix);
- cta.preferred_timings.push_back(timings_ext(svr, suffix));
- }
- } else if (svr == 254) {
- sprintf(suffix, "T8VTDB");
- if (!cta.preparsed_has_t8vtdb) {
- printf(" %s: Invalid\n", suffix);
- fail("Invalid T8VTDB.\n");
- } else {
- printf(" %s\n", suffix);
- cta.preferred_timings.push_back(timings_ext(svr, suffix));
- }
- }
- }
+ for (i = 0; i < length; i++)
+ cta_print_svr(x[i], cta.preferred_timings);
}
static std::string hdmi_latency2s(unsigned char l, bool is_video)

Privacy Policy