Skip to content

Commit 703c579

Browse files
author
Dhanush Varma
committed
style: clang-format SCC timing changes
1 parent c14979c commit 703c579

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

src/lib_ccx/ccx_decoders_708_output.c

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,6 @@ void dtvcc_write_scc(dtvcc_writer_ctx *writer, dtvcc_service_decoder *decoder, s
527527
return;
528528
static int last_scc_tx_end_ms = -1;
529529

530-
531530
if (tv->cc_count == 2)
532531
dtvcc_write_scc_header(tv, encoder);
533532

@@ -540,37 +539,37 @@ void dtvcc_write_scc(dtvcc_writer_ctx *writer, dtvcc_service_decoder *decoder, s
540539
// when hiding subtract a frame (1 frame = 34 ms)
541540
struct ccx_boundary_time time_end = get_time(tv->time_ms_hide + encoder->subs_delay - 34);
542541

543-
/* ---- SCC accurate timing: byte budgeting ---- */
544-
int bytes_required = 0;
542+
/* ---- SCC accurate timing: byte budgeting ---- */
543+
int bytes_required = 0;
545544

546-
/* Control codes: RCL + ENM + EOC (each = 2 bytes) */
547-
bytes_required += 6;
545+
/* Control codes: RCL + ENM + EOC (each = 2 bytes) */
546+
bytes_required += 6;
548547

549-
for (int i = 0; i < CCX_DTVCC_SCREENGRID_ROWS; i++)
550-
{
551-
if (!dtvcc_is_row_empty(tv, i))
552-
{
553-
int first, last;
554-
dtvcc_get_write_interval(tv, i, &first, &last);
555-
bytes_required += (last - first + 1);
556-
}
557-
}
548+
for (int i = 0; i < CCX_DTVCC_SCREENGRID_ROWS; i++)
549+
{
550+
if (!dtvcc_is_row_empty(tv, i))
551+
{
552+
int first, last;
553+
dtvcc_get_write_interval(tv, i, &first, &last);
554+
bytes_required += (last - first + 1);
555+
}
556+
}
558557

559-
/* Pad to even number of bytes */
560-
if (bytes_required % 2 != 0)
561-
bytes_required++;
558+
/* Pad to even number of bytes */
559+
if (bytes_required % 2 != 0)
560+
bytes_required++;
562561

563-
/* ---- SCC accurate timing: scheduling ---- */
564-
int frames_required = (bytes_required + 1) / 2;
565-
int tx_duration_ms = (int)(frames_required * (1000.0 / 29.97));
562+
/* ---- SCC accurate timing: scheduling ---- */
563+
int frames_required = (bytes_required + 1) / 2;
564+
int tx_duration_ms = (int)(frames_required * (1000.0 / 29.97));
566565

567-
time_show.time_in_ms -= tx_duration_ms;
568-
/* ---- SCC accurate timing: collision handling ---- */
569-
if (last_scc_tx_end_ms >= 0 &&
570-
time_show.time_in_ms < last_scc_tx_end_ms)
571-
{
572-
time_show.time_in_ms = last_scc_tx_end_ms;
573-
}
566+
time_show.time_in_ms -= tx_duration_ms;
567+
/* ---- SCC accurate timing: collision handling ---- */
568+
if (last_scc_tx_end_ms >= 0 &&
569+
time_show.time_in_ms < last_scc_tx_end_ms)
570+
{
571+
time_show.time_in_ms = last_scc_tx_end_ms;
572+
}
574573

575574
#define SCC_SNPRINTF(fmt, ...) \
576575
do \
@@ -648,8 +647,7 @@ if (last_scc_tx_end_ms >= 0 &&
648647

649648
#undef SCC_SNPRINTF
650649
write_wrapped(encoder->dtvcc_writers[tv->service_number - 1].fd, buf, strlen(buf));
651-
last_scc_tx_end_ms = time_show.time_in_ms + tx_duration_ms;
652-
650+
last_scc_tx_end_ms = time_show.time_in_ms + tx_duration_ms;
653651

654652
tv->old_cc_time_end = time_end.time_in_ms;
655653
}

0 commit comments

Comments
 (0)