Fixed intial sync, clamped rgb values
This commit is contained in:
parent
f0e1125b24
commit
dd44916d54
|
@ -0,0 +1 @@
|
||||||
|
-I..
|
|
@ -107,9 +107,9 @@ namespace gr {
|
||||||
int g = y - (11 * cb + 23 * cr) / 32;
|
int g = y - (11 * cb + 23 * cr) / 32;
|
||||||
int b = y + 113 * cb / 64;
|
int b = y + 113 * cb / 64;
|
||||||
|
|
||||||
rgb[0] = r;
|
rgb[0] = std::min(255, std::max(r, 0));
|
||||||
rgb[1] = g;
|
rgb[1] = std::min(255, std::max(g, 0));
|
||||||
rgb[2] = b;
|
rgb[2] = std::min(255, std::max(b, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -117,6 +117,7 @@ namespace gr {
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
for(size_t i = 0; i < sync_length; i++) {
|
for(size_t i = 0; i < sync_length; i++) {
|
||||||
float sample = to_frequency(samples[pos - (sync_length - 1) + i]);
|
float sample = to_frequency(samples[pos - (sync_length - 1) + i]);
|
||||||
|
//std::cout << sample << std::endl;
|
||||||
if(sample < color_low) {
|
if(sample < color_low) {
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +126,9 @@ namespace gr {
|
||||||
bool res = count > sync_thresh && !d_has_sync;
|
bool res = count > sync_thresh && !d_has_sync;
|
||||||
d_has_sync = count > sync_thresh;
|
d_has_sync = count > sync_thresh;
|
||||||
|
|
||||||
d_initial_sync = false;
|
if(res) {
|
||||||
|
d_initial_sync = false;
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue