made decoder.rs independent of new modes

This commit is contained in:
Ahmet Inan 2014-12-07 22:26:03 +01:00
parent 4e48eb185c
commit 30a6d256ba
5 changed files with 28 additions and 16 deletions

View file

@ -57,7 +57,7 @@ public class ImageView extends SurfaceView implements SurfaceHolder.Callback {
private final Allocation rsDecoderCurrentMode;
private final ScriptC_decoder rsDecoder;
private final int mode_raw = 0;
private final int mode_debug = 0;
private final int mode_robot36 = 1;
private final int mode_robot72 = 2;
private final int mode_martin1 = 3;
@ -185,7 +185,7 @@ public class ImageView extends SurfaceView implements SurfaceHolder.Callback {
{
synchronized (thread) {
switch (mode) {
case mode_raw:
case mode_debug:
imageWidth = 320;
imageHeight = bitmap.getHeight();
updateTitle(R.string.action_debug_mode);

View file

@ -17,7 +17,12 @@ limitations under the License.
#ifndef CONSTANTS_RSH
#define CONSTANTS_RSH
static const int mode_raw = 0;
static const int decoder_raw = 0;
static const int decoder_robot36 = 1;
static const int decoder_yuv = 2;
static const int decoder_rgb = 3;
static const int mode_debug = 0;
static const int mode_robot36 = 1;
static const int mode_robot72 = 2;
static const int mode_martin1 = 3;

View file

@ -143,7 +143,7 @@ void decode(int samples) {
int sync_pulse = !sync_level && sync_counter >= sync_length;
sync_counter = sync_level ? sync_counter + 1 : 0;
if (*current_mode != mode_raw) {
if (*current_mode != mode_debug) {
int detected_mode = calibration_detector(dat_value, dat_active, cnt_active, cnt_quantized);
if (detected_mode >= 0)
reset();
@ -165,19 +165,14 @@ void decode(int samples) {
seperator_counter = 0;
continue;
}
switch (*current_mode) {
case mode_robot36:
switch (current_decoder) {
case decoder_robot36:
robot36_decoder();
break;
case mode_robot72:
case decoder_yuv:
yuv_decoder();
break;
case mode_martin1:
case mode_martin2:
case mode_scottie1:
case mode_scottie2:
case mode_scottieDX:
case mode_wrasseSC2_180:
case decoder_rgb:
rgb_decoder();
break;
default:

View file

@ -25,7 +25,8 @@ void debug_sync()
{
save_cnt = 1;
save_dat = 0;
*current_mode = mode_raw;
*current_mode = mode_debug;
current_decoder = decoder_raw;
sync_length = minimum_sync_length;
maximum_length = buffer_length;
scanline_length = maximum_length;
@ -34,7 +35,8 @@ void debug_image()
{
save_dat = 1;
save_cnt = 0;
*current_mode = mode_raw;
*current_mode = mode_debug;
current_decoder = decoder_raw;
sync_length = minimum_sync_length;
maximum_length = buffer_length;
scanline_length = maximum_length;
@ -43,7 +45,8 @@ void debug_both()
{
save_cnt = 1;
save_dat = 1;
*current_mode = mode_raw;
*current_mode = mode_debug;
current_decoder = decoder_raw;
sync_length = minimum_sync_length;
maximum_length = buffer_length;
scanline_length = maximum_length;
@ -53,6 +56,7 @@ void robot36_mode()
save_dat = 1;
save_cnt = 0;
*current_mode = mode_robot36;
current_decoder = decoder_robot36;
const float tolerance = 0.8f;
const float settling_time = 0.0011f;
const float sync_seconds = 0.009f;
@ -77,6 +81,7 @@ void robot72_mode()
save_dat = 1;
save_cnt = 0;
*current_mode = mode_robot72;
current_decoder = decoder_yuv;
const float tolerance = 0.8f;
const float settling_time = 0.0011f;
const float sync_seconds = 0.009f;
@ -105,6 +110,7 @@ void martin1_mode()
save_cnt = 0;
save_dat = 1;
*current_mode = mode_martin1;
current_decoder = decoder_rgb;
const float tolerance = 0.5f;
const float sync_seconds = 0.004862f;
const float sync_porch_seconds = 0.000572f;
@ -128,6 +134,7 @@ void martin2_mode()
save_cnt = 0;
save_dat = 1;
*current_mode = mode_martin2;
current_decoder = decoder_rgb;
const float tolerance = 0.5f;
const float sync_seconds = 0.004862f;
const float sync_porch_seconds = 0.000572f;
@ -151,6 +158,7 @@ void scottie1_mode()
save_cnt = 0;
save_dat = 1;
*current_mode = mode_scottie1;
current_decoder = decoder_rgb;
const float tolerance = 0.8f;
const float settling_time = 0.0011f;
const float sync_seconds = 0.009f;
@ -175,6 +183,7 @@ void scottie2_mode()
save_cnt = 0;
save_dat = 1;
*current_mode = mode_scottie2;
current_decoder = decoder_rgb;
const float tolerance = 0.8f;
const float settling_time = 0.0011f;
const float sync_seconds = 0.009f;
@ -199,6 +208,7 @@ void scottieDX_mode()
save_cnt = 0;
save_dat = 1;
*current_mode = mode_scottieDX;
current_decoder = decoder_rgb;
const float tolerance = 0.8f;
const float settling_time = 0.0011f;
const float sync_seconds = 0.009f;
@ -223,6 +233,7 @@ void wrasseSC2_180_mode()
save_cnt = 0;
save_dat = 1;
*current_mode = mode_wrasseSC2_180;
current_decoder = decoder_rgb;
const float tolerance = 0.5f;
const float sync_seconds = 0.0055225f;
const float sync_porch_seconds = 0.0005f;

View file

@ -20,6 +20,7 @@ limitations under the License.
static ema_t avg_power, leader_lowpass;
static ddc_t cnt_ddc, dat_ddc;
static fmd_t cnt_fmd, dat_fmd;
static int current_decoder;
static int sample_rate, even_hpos;
static int maximum_variance, minimum_sync_length;
static int scanline_length, minimum_length, maximum_length;