mirror of
https://github.com/marqs85/ossc
synced 2025-12-11 19:46:07 +03:00
Shrink the code by 16 bytes by using an array to map values
This commit is contained in:
parent
ab61fd0c67
commit
571b588da7
@ -809,7 +809,6 @@ int main()
|
|||||||
|
|
||||||
switch (target_mode) {
|
switch (target_mode) {
|
||||||
case AV1_RGBs:
|
case AV1_RGBs:
|
||||||
phy_input_sel = PHY_AV1;
|
|
||||||
target_input = TVP_INPUT1;
|
target_input = TVP_INPUT1;
|
||||||
target_format = FORMAT_RGBS;
|
target_format = FORMAT_RGBS;
|
||||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||||
@ -817,7 +816,6 @@ int main()
|
|||||||
target_pcm = PCM_INPUT4;
|
target_pcm = PCM_INPUT4;
|
||||||
break;
|
break;
|
||||||
case AV1_RGsB:
|
case AV1_RGsB:
|
||||||
phy_input_sel = PHY_AV1;
|
|
||||||
target_input = TVP_INPUT1;
|
target_input = TVP_INPUT1;
|
||||||
target_format = FORMAT_RGsB;
|
target_format = FORMAT_RGsB;
|
||||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||||
@ -825,7 +823,6 @@ int main()
|
|||||||
target_pcm = PCM_INPUT4;
|
target_pcm = PCM_INPUT4;
|
||||||
break;
|
break;
|
||||||
case AV1_YPBPR:
|
case AV1_YPBPR:
|
||||||
phy_input_sel = PHY_AV1;
|
|
||||||
target_input = TVP_INPUT1;
|
target_input = TVP_INPUT1;
|
||||||
target_format = FORMAT_YPbPr;
|
target_format = FORMAT_YPbPr;
|
||||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||||
@ -833,7 +830,6 @@ int main()
|
|||||||
target_pcm = PCM_INPUT4;
|
target_pcm = PCM_INPUT4;
|
||||||
break;
|
break;
|
||||||
case AV2_YPBPR:
|
case AV2_YPBPR:
|
||||||
phy_input_sel = PHY_AV2;
|
|
||||||
target_input = TVP_INPUT1;
|
target_input = TVP_INPUT1;
|
||||||
target_format = FORMAT_YPbPr;
|
target_format = FORMAT_YPbPr;
|
||||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||||
@ -841,7 +837,6 @@ int main()
|
|||||||
target_pcm = PCM_INPUT3;
|
target_pcm = PCM_INPUT3;
|
||||||
break;
|
break;
|
||||||
case AV2_RGsB:
|
case AV2_RGsB:
|
||||||
phy_input_sel = PHY_AV2;
|
|
||||||
target_input = TVP_INPUT1;
|
target_input = TVP_INPUT1;
|
||||||
target_format = FORMAT_RGsB;
|
target_format = FORMAT_RGsB;
|
||||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||||
@ -849,7 +844,6 @@ int main()
|
|||||||
target_pcm = PCM_INPUT3;
|
target_pcm = PCM_INPUT3;
|
||||||
break;
|
break;
|
||||||
case AV3_RGBHV:
|
case AV3_RGBHV:
|
||||||
phy_input_sel = PHY_AV3;
|
|
||||||
target_input = TVP_INPUT3;
|
target_input = TVP_INPUT3;
|
||||||
target_format = FORMAT_RGBHV;
|
target_format = FORMAT_RGBHV;
|
||||||
target_typemask = VIDEO_PC;
|
target_typemask = VIDEO_PC;
|
||||||
@ -857,7 +851,6 @@ int main()
|
|||||||
target_pcm = PCM_INPUT2;
|
target_pcm = PCM_INPUT2;
|
||||||
break;
|
break;
|
||||||
case AV3_RGBs:
|
case AV3_RGBs:
|
||||||
phy_input_sel = PHY_AV3;
|
|
||||||
target_input = TVP_INPUT3;
|
target_input = TVP_INPUT3;
|
||||||
target_format = FORMAT_RGBS;
|
target_format = FORMAT_RGBS;
|
||||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||||
@ -865,7 +858,6 @@ int main()
|
|||||||
target_pcm = PCM_INPUT2;
|
target_pcm = PCM_INPUT2;
|
||||||
break;
|
break;
|
||||||
case AV3_RGsB:
|
case AV3_RGsB:
|
||||||
phy_input_sel = PHY_AV3;
|
|
||||||
target_input = TVP_INPUT3;
|
target_input = TVP_INPUT3;
|
||||||
target_format = FORMAT_RGsB;
|
target_format = FORMAT_RGsB;
|
||||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||||
@ -873,7 +865,6 @@ int main()
|
|||||||
target_pcm = PCM_INPUT2;
|
target_pcm = PCM_INPUT2;
|
||||||
break;
|
break;
|
||||||
case AV3_YPBPR:
|
case AV3_YPBPR:
|
||||||
phy_input_sel = PHY_AV3;
|
|
||||||
target_input = TVP_INPUT3;
|
target_input = TVP_INPUT3;
|
||||||
target_format = FORMAT_YPbPr;
|
target_format = FORMAT_YPbPr;
|
||||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||||
@ -887,6 +878,8 @@ int main()
|
|||||||
if (target_mode != AV_KEEP) {
|
if (target_mode != AV_KEEP) {
|
||||||
printf("### SWITCH MODE TO %s ###\n", avinput_str[target_mode]);
|
printf("### SWITCH MODE TO %s ###\n", avinput_str[target_mode]);
|
||||||
|
|
||||||
|
phy_input_sel = avinput_to_phyinput[target_mode];
|
||||||
|
|
||||||
// The input changed, so load the appropriate profile
|
// The input changed, so load the appropriate profile
|
||||||
if (profile_sel != input_profiles[phy_input_sel]) {
|
if (profile_sel != input_profiles[phy_input_sel]) {
|
||||||
profile_sel = input_profiles[phy_input_sel];
|
profile_sel = input_profiles[phy_input_sel];
|
||||||
|
|||||||
@ -78,9 +78,24 @@ typedef enum {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
PHY_AV1 = 0,
|
PHY_AV1 = 0,
|
||||||
PHY_AV2 = 1,
|
PHY_AV2 = 1,
|
||||||
PHY_AV3 = 2
|
PHY_AV3 = 2,
|
||||||
|
PHY_INVALID = 3
|
||||||
} phyinput_t;
|
} phyinput_t;
|
||||||
|
|
||||||
|
static phyinput_t avinput_to_phyinput[] = {
|
||||||
|
[AV_KEEP] = PHY_INVALID,
|
||||||
|
[AV1_RGBs] = PHY_AV1,
|
||||||
|
[AV1_RGsB] = PHY_AV1,
|
||||||
|
[AV1_YPBPR] = PHY_AV1,
|
||||||
|
[AV2_YPBPR] = PHY_AV2,
|
||||||
|
[AV2_RGsB] = PHY_AV2,
|
||||||
|
[AV3_RGBHV] = PHY_AV3,
|
||||||
|
[AV3_RGBs] = PHY_AV3,
|
||||||
|
[AV3_RGsB] = PHY_AV3,
|
||||||
|
[AV3_YPBPR] = PHY_AV3,
|
||||||
|
[AV_LAST] = PHY_INVALID
|
||||||
|
};
|
||||||
|
|
||||||
// In reverse order of importance
|
// In reverse order of importance
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NO_CHANGE = 0,
|
NO_CHANGE = 0,
|
||||||
|
|||||||
@ -29,7 +29,6 @@ extern avmode_t cm;
|
|||||||
extern avconfig_t tc;
|
extern avconfig_t tc;
|
||||||
extern mode_data_t video_modes[];
|
extern mode_data_t video_modes[];
|
||||||
extern avinput_t target_mode;
|
extern avinput_t target_mode;
|
||||||
extern phyinput_t phy_input_sel;
|
|
||||||
extern alt_u8 update_cur_vm;
|
extern alt_u8 update_cur_vm;
|
||||||
extern alt_u8 input_profiles[3];
|
extern alt_u8 input_profiles[3];
|
||||||
extern alt_u8 profile_sel;
|
extern alt_u8 profile_sel;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user