kopia lustrzana https://github.com/xdsopl/robot36
do not depend on seperator counter if previous scan had a sync timeout
rodzic
7b054a0944
commit
41657bcea6
|
@ -415,9 +415,11 @@ void initialize(float rate, int length, int width, int height)
|
||||||
|
|
||||||
static void robot36_decoder()
|
static void robot36_decoder()
|
||||||
{
|
{
|
||||||
if (2 * abs(seperator_counter) > seperator_length)
|
static prev_timeout;
|
||||||
|
if (!prev_timeout && 2 * abs(seperator_counter) > seperator_length)
|
||||||
vpos = ~1 & vpos | seperator_counter > 0;
|
vpos = ~1 & vpos | seperator_counter > 0;
|
||||||
if (vpos&1) {
|
if (vpos&1 || hpos >= maximum_length) {
|
||||||
|
vpos |= 1;
|
||||||
for (int i = 0; i < bitmap_width; ++i) {
|
for (int i = 0; i < bitmap_width; ++i) {
|
||||||
uchar even_y = value_buffer[i * (y_end-y_begin) / bitmap_width + y_begin];
|
uchar even_y = value_buffer[i * (y_end-y_begin) / bitmap_width + y_begin];
|
||||||
uchar u = value_buffer[i * (u_end-u_begin) / bitmap_width + u_begin];
|
uchar u = value_buffer[i * (u_end-u_begin) / bitmap_width + u_begin];
|
||||||
|
@ -426,17 +428,16 @@ static void robot36_decoder()
|
||||||
pixel_buffer[bitmap_width * (vpos-1) + i] = rsYuvToRGBA_uchar4(even_y, u, v);
|
pixel_buffer[bitmap_width * (vpos-1) + i] = rsYuvToRGBA_uchar4(even_y, u, v);
|
||||||
pixel_buffer[bitmap_width * vpos + i] = rsYuvToRGBA_uchar4(odd_y, u, v);
|
pixel_buffer[bitmap_width * vpos + i] = rsYuvToRGBA_uchar4(odd_y, u, v);
|
||||||
}
|
}
|
||||||
if (hpos >= maximum_length)
|
prev_timeout = hpos >= maximum_length;
|
||||||
even_hpos = (hpos -= scanline_length);
|
if (prev_timeout)
|
||||||
|
hpos -= scanline_length;
|
||||||
else
|
else
|
||||||
even_hpos = hpos = 0;
|
hpos = 0;
|
||||||
|
even_hpos = 0;
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < bitmap_width; ++i)
|
for (int i = 0; i < bitmap_width; ++i)
|
||||||
pixel_buffer[bitmap_width * vpos + i] = rgb(0, 0, 0);
|
pixel_buffer[bitmap_width * vpos + i] = rgb(0, 0, 0);
|
||||||
if (hpos < maximum_length)
|
even_hpos = hpos;
|
||||||
even_hpos = hpos;
|
|
||||||
else
|
|
||||||
even_hpos = hpos = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void yuv_decoder()
|
static void yuv_decoder()
|
||||||
|
@ -557,6 +558,7 @@ void decode(int samples) {
|
||||||
if (hpos < minimum_length) {
|
if (hpos < minimum_length) {
|
||||||
hpos = 0;
|
hpos = 0;
|
||||||
even_hpos = 0;
|
even_hpos = 0;
|
||||||
|
seperator_counter = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|
Ładowanie…
Reference in New Issue