OsmoTV: Generate correct amplitude of color signal (hopefully)

pull/1/head
Andreas Eversberg 4 years ago
parent 4362c78f38
commit 5d9a9b59c3
  1. 10
      src/tv/bas.c
  2. 4
      src/tv/color.c
  3. 4
      src/tv/ebu.c
  4. 8
      src/tv/fubk.c

@ -49,7 +49,7 @@
#define H_CBURST_STOP 0.0000094
#define COLOR_CARRIER 4433618.75
#define COLOR_OFFSET 0.0000004
#define BURST_AMPLITUDE 0.15
#define BURST_AMPLITUDE 0.3
#define COLOR_FILTER_ITER 1
void bas_init(bas_t *bas, double samplerate, enum bas_type type, int fbas, double circle_radius, int color_bar, int grid_only, const char *station_id, int grid_width, unsigned short *img, int width, int height)
@ -88,7 +88,7 @@ int bas_generate(bas_t *bas, sample_t *sample)
int have_image;
sample_t color_u[(int)(bas->samplerate / 15625.0) + 10];
sample_t color_v[(int)(bas->samplerate / 15625.0) + 10];
double _sin, _cos;
double _sin, _cos, chroma;
double color_step = COLOR_CARRIER / bas->samplerate * 2 * M_PI;
/* the offset is specified by delaying Y signal by 0.4 uS. */
// additianlly we compensate the delay caused by the color filter, that is 2 samples per iteration */
@ -275,9 +275,9 @@ int bas_generate(bas_t *bas, sample_t *sample)
bas->color_phase -= 2.0 * M_PI;
_sin = sin(bas->color_phase);
_cos = cos(bas->color_phase);
sample[c-color_offset] += color_u[c] * _cos - color_v[c] * _sin;
sample[c-color_offset] += color_u[c] * _sin + color_v[c] * _cos;
// puts(debug_amplitude(sample[c-color_offset]));
chroma = color_u[c] * _cos - color_v[c] * _sin;
/* scale level of chroma to range of BAS signal */
sample[c-color_offset] += chroma * (WHITE_LEVEL - BLACK_LEVEL);
}
/* filter bas signal */

@ -60,8 +60,8 @@ int color_gen_line(sample_t *sample, double x, double samplerate, sample_t *colo
colorphase = (360.0 - color_bar[b].phase) / 180.0 * M_PI;
else
colorphase = color_bar[b].phase / 180.0 * M_PI;
U = cos(colorphase) * amplitude / 2.0;
V = sin(colorphase) * amplitude / 2.0;
U = cos(colorphase) * amplitude;
V = sin(colorphase) * amplitude;
while (x < line_end) {
color_u[i] = U;
color_v[i] = V;

@ -61,8 +61,8 @@ int ebu_gen_line(sample_t *sample, double x, double samplerate, sample_t *color_
colorphase = (360.0 - color_bar[b].phase) / 180.0 * M_PI;
else
colorphase = color_bar[b].phase / 180.0 * M_PI;
U = cos(colorphase) * amplitude / 2.0;
V = sin(colorphase) * amplitude / 2.0;
U = cos(colorphase) * amplitude;
V = sin(colorphase) * amplitude;
render_end = (line_end - line_start) / 8 * (b + 1) + line_start;
while (x < render_end) {
color_u[i] = U;

@ -101,8 +101,8 @@ static double mittelfeld(sample_t *sample, double samplerate, int *_i, double *_
colorphase = (360.0 - color_bar[b].phase) / 180.0 * M_PI;
else
colorphase = color_bar[b].phase / 180.0 * M_PI;
U = cos(colorphase) * amplitude / 2.0;
V = sin(colorphase) * amplitude / 2.0;
U = cos(colorphase) * amplitude;
V = sin(colorphase) * amplitude;
render_end = render_start + GRID_WIDTH * 1.5;
while (x < render_end) {
color_u[i] = U;
@ -223,8 +223,8 @@ static double mittelfeld(sample_t *sample, double samplerate, int *_i, double *_
colorphase = (360.0 - 145.9) / 180.0 * M_PI;
else
colorphase = 145.9 / 180.0 * M_PI;
color_u[i] = cos(colorphase) * V / 2.0;
color_v[i] = sin(colorphase) * V / 2.0;
color_u[i] = cos(colorphase) * V;
color_v[i] = sin(colorphase) * V;
sample[i++] = Y + sin(phase) / 2.0;
phase += phase_step;
x += step;

Loading…
Cancel
Save