setup_tab_reeng.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:180k
源码类别:

DVD

开发平台:

C/C++

  1.                                             osd_draw_rect(X_60-4, yyStart-2, 32+8, yyLen, clrCursorColor);
  2.                                                                                 
  3.                                         }
  4.                                             #ifdef NO_SHOW_ADD_ICON//zhaoyanhua add 2003-12-9 17:41                                     
  5.                                         if ( (id==STR_OS_CSPK_DELAY) || (id==STR_OS_SSPK_DELAY) ) 
  6.                                         osd_DrawLine(X_76, yStart+28-4, X_76, yStart+yDelta+32+8, fontColor, 3);
  7.                                         else 
  8.                                     #endif
  9.                                         #ifdef ADD_DVI311_SETUP
  10.                                         if(id == STR_OS_DVI311_MODE)
  11.                                         {
  12.                                             #define X_60_1   SETUP_SUB_XSTART*16+60+30
  13.                                             #define X_76_1   SETUP_SUB_XSTART*16+76+30
  14.                                             #define X_94_1   SETUP_SUB_XSTART*16+94+30
  15.                                             #define X_96_1   SETUP_SUB_XSTART*16+96+30
  16.                                             osd_DrawLine(X_76_1, yStart+28, X_76_1, yStart+yDelta+32, fontColor, 3);
  17.                                             osd_draw_rect(X_60_1, yNew, 32, 8, bgColor);
  18.                                             //top
  19.                                             if (p_scan==1)
  20.                                                 osd_DrawLine(X_60_1, yNew, X_96_1, yNew, uColor, 2);
  21.                                             else
  22.                                                 osd_DrawLine(X_60_1, yNew, X_96_1, yNew, uColor, 1);
  23.                                             //left
  24.                                             osd_DrawLine(X_60_1, yNew, X_60_1, yNew_8, uColor, 1);
  25.                                             //botton
  26.                                             if (p_scan==1)
  27.                                                 osd_DrawLine(X_60_1, yNew_8, X_96_1, yNew_8, dColor, 2);
  28.                                             else
  29.                                                 osd_DrawLine(X_60_1, yNew_8, X_96_1, yNew_8, dColor, 1);
  30.                                             //right
  31.                                             osd_DrawLine(X_94_1, yNew, X_94_1, yNew_8, dColor, 1);
  32.                                         }
  33.                                         else
  34.                                         #endif//#ifdef ADD_DVI311_SETUP
  35.                                         {
  36.                                         osd_DrawLine(X_76, yStart+28, X_76, yStart+yDelta+32, fontColor, 3);
  37.                                         osd_draw_rect(X_60, yNew, 32, 8, bgColor);
  38.                                         //top
  39.                                         if (p_scan==1)
  40.                                             osd_DrawLine(X_60, yNew, X_96, yNew, uColor, 2);
  41.                                         else
  42.                                             osd_DrawLine(X_60, yNew, X_96, yNew, uColor, 1);
  43.                                         //left
  44.                                         osd_DrawLine(X_60, yNew, X_60, yNew_8, uColor, 1);
  45.                                         //botton
  46.                                         if (p_scan==1)
  47.                                             osd_DrawLine(X_60, yNew_8, X_96, yNew_8, dColor, 2);
  48.                                         else
  49.                                             osd_DrawLine(X_60, yNew_8, X_96, yNew_8, dColor, 1);
  50.                                         //right
  51.                                         osd_DrawLine(X_94, yNew, X_94, yNew_8, dColor, 1);
  52. }
  53. }
  54. #endif //end of DVD_SETUP_REENG
  55. #if 0//ndef SETUP_DVD_REENG
  56. void revise_val(int dir, INT8 *x,int max,int min)
  57. {
  58.     if (dir)
  59.     {
  60.        if (*x < max)  (*x)++;
  61.     } else
  62.     {
  63.        if (*x > min)  (*x)--;
  64.     }
  65. }
  66. #endif
  67. //=============================================
  68. //for DVD_SETUP_REENG   //added by JS   //20040728
  69. #if 0//ndef DVD_SETUP_REENG
  70. //If the item(id) is scaleable, here we will do it's corresponding action by dir(down=0, up=1)
  71. void setup_CookScaleItem(UINT8 id, UINT8 dir)
  72. {
  73.     int val = SETUP_ECHO; // give a default value
  74.         if (id==STR_OS_ECHO) {
  75.             //echo_level(0 ~ 8)
  76.             revise_val(dir,&echo_level,8,0);
  77.             SETUP_ECHO = echo_level+2;
  78. #ifdef USE_MIC_ECHO_PARAM
  79.                            AudioSetEchoPara(echo_level);
  80. #else
  81.             AudioSetEcho(echo_level, echo_level);
  82. #endif
  83.             val=SETUP_ECHO;
  84.         } else
  85. #ifdef  Ti3001_OSD_UI_2
  86.             if (id==STR_OS_AMP_MAINVOLUME)
  87.             {
  88.                 //echo_level(0 ~ 8)
  89.                 revise_val(dir,&amp_volume_level,14,0);
  90.                 SETUP_AMP_VOLUME = amp_volume_level+2;
  91.                 //AudioSetEcho(echo_level, echo_decay);
  92.                 //printf("amp_volume_level=%dn",amp_volume_level);
  93.                 //audio_volume=amp_volume_level;
  94.                 //AudioSetVolume(audio_volume);
  95.                 ti_set_volume(SET_TOTAL_VOLUME,amp_volume_level*7);
  96.                 val=SETUP_AMP_VOLUME;
  97.             } else
  98.                 if (id==STR_OS_AMP_FSPK)
  99.                 {
  100.                     //echo_decay(0 ~ 8)
  101.                     revise_val(dir,&amp_fspk_level,14,0);
  102.                     SETUP_AMP_FSPK = amp_fspk_level+2;
  103.                     //AudioSetEcho(echo_level, echo_decay);
  104.                     //printf("amp_fspk_level=%d,amp_fspk_balance_level=%dn",amp_fspk_level,amp_fspk_balance_level);
  105.                     set_tas3001ch_volume(FSPK,amp_fspk_balance_level,amp_fspk_level*7);
  106.                     val=SETUP_AMP_FSPK;
  107.                 } else
  108.                     if (id==STR_OS_AMP_FSPK_BALANCE)
  109.                     {
  110.                         //echo_decay(0 ~ 8)
  111.                         revise_val(dir,&amp_fspk_balance_level,14,0);
  112.                         SETUP_AMP_FSPK_BALANCE = amp_fspk_balance_level+2;
  113.                         //printf("amp_fspk_level=%d,amp_fspk_balance_level=%dn",amp_fspk_level,amp_fspk_balance_level);
  114.                         set_tas3001ch_volume(FSPK,amp_fspk_balance_level,amp_fspk_level*7);
  115.                         //AudioSetEcho(echo_level, echo_decay);
  116.                         val=SETUP_AMP_FSPK_BALANCE;
  117.                     } else
  118.                         if (id==STR_OS_AMP_SSPK)
  119.                         {
  120.                             //echo_decay(0 ~ 8)
  121.                             revise_val(dir,&amp_sspk_level,14,0);
  122.                             SETUP_AMP_SSPK = amp_sspk_level+2;
  123.                             //AudioSetEcho(echo_level, echo_decay);
  124.                             //printf("amp_sspk_level=%d,amp_sspk_balance_level=%dn",amp_sspk_level,amp_sspk_balance_level);
  125.                             set_tas3001ch_volume(SSPK,amp_sspk_balance_level,amp_sspk_level*7);
  126.                             val=SETUP_AMP_SSPK;
  127.                         } else
  128.                             if (id==STR_OS_AMP_SSPK_BALANCE)
  129.                             {
  130.                                 //echo_decay(0 ~ 8)
  131.                                 revise_val(dir,&amp_sspk_balance_level,14,0);
  132.                                 SETUP_AMP_SSPK_BALANCE = amp_sspk_balance_level+2;
  133.                                 //AudioSetEcho(echo_level, echo_decay);
  134.                                 //printf("amp_sspk_level=%d,amp_sspk_balance_level=%dn",amp_sspk_level,amp_sspk_balance_level);
  135.                                 set_tas3001ch_volume(SSPK,amp_sspk_balance_level,amp_sspk_level*7);
  136.                                 val=SETUP_AMP_SSPK_BALANCE;
  137.                             } else
  138.                                 if (id==STR_OS_AMP_CSPK)
  139.                                 {
  140.                                     //echo_decay(0 ~ 8)
  141.                                     revise_val(dir,&amp_cspk_level,14,0);
  142.                                     SETUP_AMP_CSPK = amp_cspk_level+2;
  143.                                     //AudioSetEcho(echo_level, echo_decay);
  144.                                     //printf("amp_cspk_level=%d,amp_subwoofer_level=%dn",amp_cspk_level,amp_subwoofer_level);
  145.                                     set_tas3001ch_volume(CSSPK,amp_cspk_level/(amp_subwoofer_level+1),amp_cspk_level*7);
  146.                                     val=SETUP_AMP_CSPK;
  147.                                 } else
  148.                                     if (id==STR_OS_AMP_SUBWOOFER)
  149.                                     {
  150.                                         //echo_decay(0 ~ 8)
  151.                                         revise_val(dir,&amp_subwoofer_level,14,0);
  152.                                         SETUP_AMP_SUBWOOFER = amp_subwoofer_level+2;
  153.                                         //AudioSetEcho(echo_level, echo_decay);
  154.                                         //printf("amp_cspk_level=%d,amp_subwoofer_level=%dn",amp_cspk_level,amp_subwoofer_level);
  155.                                         set_tas3001ch_volume(CSSPK,amp_cspk_level/(amp_subwoofer_level+1),amp_subwoofer_level*7);
  156.                                         val=SETUP_AMP_SUBWOOFER;
  157.                                     } else
  158.                                         if (id==STR_OS_AMP_BASS)
  159.                                         {
  160.                                             //echo_decay(0 ~ 8)
  161.                                             revise_val(dir,&amp_bass_level,12,0);
  162.                                             SETUP_AMP_BASS = amp_bass_level+2;
  163.                                             //AudioSetEcho(echo_level, echo_decay);
  164.                                             //printf("amp_bass_level=%dn",amp_bass_level);
  165.                                             ti_set_volume(SET_BASS ,(amp_bass_level-6)*2);
  166.                                             val=SETUP_AMP_BASS;
  167.                                         } else
  168.                                             if (id==STR_OS_AMP_TREMBLE)
  169.                                             {
  170.                                                 //echo_decay(0 ~ 8)
  171.                                                 revise_val(dir,&amp_tremble_level,12,0);
  172.                                                 SETUP_AMP_TREMBLE = amp_tremble_level+2;
  173.                                                 //AudioSetEcho(echo_level, echo_decay);
  174.                                                 //printf("amp_tremble_level=%dn",amp_tremble_level);
  175.                                                 ti_set_volume(SET_TREBLE ,(amp_tremble_level-6)*2);
  176.                                                 val=SETUP_AMP_TREMBLE;
  177.                                             } else
  178.                                                 if (id==STR_OS_AMP_DYNAMICRANGE)
  179.                                                 {
  180.                                                     //echo_decay(0 ~ 8)
  181.                                                     revise_val(dir,&amp_dynamic_level,12,0);
  182.                                                     SETUP_AMP_DYNAMIC = amp_dynamic_level+2;
  183.                                                     //AudioSetEcho(echo_level, echo_decay);
  184.                                                     //printf("amp_dynamic_level=%dn",amp_dynamic_level);
  185.                                                     ti_set_volume(SET_DRC ,6-amp_dynamic_level/2);
  186.                                                     val=SETUP_AMP_DYNAMIC;
  187.                                                 } else
  188. #endif
  189.                                                     if (id==STR_OS_KEY) {
  190.                                                         //audio_key(-6 ~ 6)
  191.                                                         #ifdef SUPPORT_PROLOGIC_II
  192.                                                         if (SETUP_PROLOGIC_II!=4)
  193.                                                         {
  194.                                                             SETUP_PROLOGIC_II=4;    // alan, 2003/8/11 01:56PM                          
  195.                                                             exe_setup_function(STR_OS_PROLOGIC,STR_OS_OFF,0);
  196.                                                             run_save_sel_cmd(AUDPAGE, PROLOGIC_II);//nono 2004-2-16 9:28
  197.                                                         }
  198.                                                         #endif
  199.                                                         revise_val(dir,&audio_key,6,-6);
  200.                                                         val=audio_key+2;
  201.                                                         SETUP_KEY = val+6;
  202.                                                         AudioSetKey(SETUP_KEY); //audio_key:-6 ~ 6, map to 1~15
  203.                                                     } else
  204.                                                         if (id==STR_OS_MIC_VOL||id==STR_OS_MIC_VOL_1||id==STR_OS_MIC_VOL_2) {//wangfeng 2003-09-12 17:12
  205.                                                             //mic_volume(0 ~ 8)
  206.                                                             revise_val(dir,&mic_volume,8,0);
  207.                                                             //#ifdef    MIC_2CHANNEL    //wangfeng 2003-09-12 21:40
  208.                                                             //if(id==STR_OS_MIC_VOL||id==STR_OS_MIC_VOL_1)
  209.                                                             //mic_volume=SETUP_MIC_VOL;
  210.                                                             //else if(id==STR_OS_MIC_VOL_2)
  211.                                                             //mic_volume=SETUP_MIC_VOL_2;
  212.                                                             //#endif 
  213.                                                             if(id==STR_OS_MIC_VOL||id==STR_OS_MIC_VOL_1)
  214.                                                             {
  215.                                                             SETUP_MIC_VOL = mic_volume+2;
  216.                                                             AudioSetMICVol(mic_volume);
  217.                                                             //AudioSetMICVol(SETUP_MIC_VOL-2);
  218.                                                             val=SETUP_MIC_VOL;
  219.                                                             }
  220.                                                             #ifdef  MIC_2CHANNEL
  221.                                                             else if(id==STR_OS_MIC_VOL_2)
  222.                                                             {
  223.                                                             SETUP_MIC_VOL_2 = mic_volume+2;
  224.                                                             AudioSetMICVol_2(mic_volume);
  225.                                                             val=SETUP_MIC_VOL_2;
  226.                                                             }
  227.                                                             #endif
  228. #ifdef FUSS_DVD //Jeff 20020524
  229.                                                             if ( setup_IsMICOff() ) {
  230.                                                                 setup_SetMICAuto();
  231.                                                             }
  232. #endif
  233.                                                             //AudioSetMICVol(mic_volume);
  234.                                                             //val=SETUP_MIC_VOL;
  235.                                                         } else
  236. #ifndef AC3_BASS_MANAGEMENT
  237.                                                             if (id==STR_OS_FSPK) {
  238.                                                                 revise_val(dir,&SETUP_SPK_FRONT,10,2);
  239.                                                                 val=SETUP_SPK_FRONT;
  240.                                                                 #ifdef YUXING_DVD
  241.                                                                 fspk_volume=SETUP_SPK_FRONT-4;
  242.                                                                 #endif
  243.                                                                 //set front speaker gain
  244.                                                                 AudioSetFSPKGain(SETUP_SPK_FRONT-2);
  245.                                                             } else
  246.                                                                 if (id==STR_OS_CSPK) {
  247.                                                                     revise_val(dir,&SETUP_SPK_CENTER,10,2);
  248.                                                                     val=SETUP_SPK_CENTER;
  249.                                                                     #ifdef YUXING_DVD
  250.                                                                     cspk_volume=SETUP_SPK_CENTER-4;
  251.                                                                     #endif
  252.                                                                     //set center speaker gain
  253.                                                                     AudioSetCSPKGain(SETUP_SPK_CENTER-2);
  254.                                                                 } else
  255.                                                                     if (id==STR_OS_SSPK) {
  256.                                                                         revise_val(dir,&SETUP_SPK_SURROUND,10,2);
  257.                                                                         val=SETUP_SPK_SURROUND;
  258.                                                                         #ifdef YUXING_DVD
  259.                                                                         sspk_volume=SETUP_SPK_SURROUND-4;
  260.                                                                         #endif
  261.                                                                         //set surround speaker gain
  262.                                                                         AudioSetSSPKGain(SETUP_SPK_SURROUND-2);
  263.                                                                     } else
  264. #endif
  265.                                                                         if (id==STR_OS_CSPK_DELAY) {
  266.                                                                     #ifdef NO_SHOW_ADD_ICON//zhaoyanhua add 2003-12-9 17:18
  267.                                                                         revise_val(dir,&SETUP_SPK_CENTER_DELAY,8,2);//0~6MS
  268.                                                                     #else 
  269.                                                                             revise_val(dir,&SETUP_SPK_CENTER_DELAY,7,2);
  270.                                                                     #endif
  271.                                                                             val=SETUP_SPK_CENTER_DELAY;
  272.                                                                             //set center speaker delay, 1:center speaker
  273.                                                                             AudioSetSpkDelay(1, SETUP_SPK_CENTER_DELAY-2);
  274.                                                                         } else
  275. #ifdef ADD_DVI311_SETUP
  276.     if (id==STR_OS_DVI311_MODE)  
  277.     {
  278.         revise_val(dir,&dvi311_mode,6,0);//6 为等级数
  279.         //kevin add for limit the functions of display                           @2k40514
  280.         if (((dvi311_tv_mode>0x84)//NTSC or PAL60
  281.             &&(dvi311_mode==1))//576P
  282.             ||((dvi311_tv_mode==0x84)//PAL
  283.             && (dvi311_mode==2)))//480P
  284.         {
  285.             if(dir)
  286.                 dvi311_mode+=1;
  287.             else
  288.                 dvi311_mode-=1;
  289.         }
  290.         val = dvi311_mode+2;
  291.               psprintf(linebuf, "dvi311_mode %xn", dvi311_mode); 
  292.               epp_write_wait(linebuf);
  293.         scaler_main(); //040512
  294.     }else 
  295. #endif
  296.                                                                             if (id==STR_OS_DYNAMICRANGE) { //Jeff 20020604
  297.                                                                                 revise_val(dir,&ac3_dynarange,8,0);
  298.                                                                                 SETUP_AC3DIGITAL_DYNA = ac3_dynarange+2;
  299.                                                                                 val = SETUP_AC3DIGITAL_DYNA;
  300.                                                                                 set_AC3DynamicRange();
  301.                                                                             } else if (id==STR_OS_SSPK_DELAY)
  302.                                                                             {
  303.                                                                     #ifdef NO_SHOW_ADD_ICON//zhaoyanhua add 2003-12-9 17:18
  304.                                                                                 revise_val(dir,&SETUP_SPK_SURROUND_DELAY,8,2);//0~18MS
  305.                                                                     #else
  306.                                                                                 revise_val(dir,&SETUP_SPK_SURROUND_DELAY,7,2);
  307.                                                                 #endif                  
  308.                                                                                 val=SETUP_SPK_SURROUND_DELAY;
  309.                                                                                 //set surround speaker delay, 2:surround speaker
  310.                                                                                 AudioSetSpkDelay(2, (SETUP_SPK_SURROUND_DELAY-2)*3);
  311.                                                                             }
  312.                                                                             else if (id == STR_OS_BRIGHTNESS)
  313.                                                                             {
  314.                                                                                 revise_val(dir, &SETUP_BRIGHTNESS, 14, 2);
  315.                                                                                 val = SETUP_BRIGHTNESS;
  316.                                                                                 SetBrightness(val - 2);
  317.                                                                             }
  318.                                                                             else if (id == STR_OS_CONTRAST)
  319.                                                                             {
  320.                                                                                 revise_val(dir,&SETUP_CONTRAST, 14, 2);
  321.                                                                                 val=SETUP_CONTRAST;
  322.                                                                                 SetContrast(val - 2);
  323.                                                                             }
  324.                                                                             else if (id == STR_OS_HUE)
  325.                                                                             {
  326.                                                                                 revise_val(dir,&SETUP_HUE, 14, 2);
  327.                                                                                 val=SETUP_HUE;
  328.                                                                                 SetHUE(val - 2);
  329.                                                                             }
  330.                                                                             else if (id == STR_OS_SATURATION)
  331.                                                                             {
  332.                                                                                 revise_val(dir,&SETUP_SATURATION, 14, 2);
  333.                                                                                 val=SETUP_SATURATION;
  334.                                                                                 SetSaturation(val - 2);
  335.                                                                             }
  336. #ifdef DIP_CFG_ENABLE
  337.                                                                             else if (id == STR_OS_DEINTLC)
  338.                                                                             {
  339.                                                                                 revise_val(dir,&SETUP_DE_INTERLACE, 8, 2);
  340.                                                                                 val=SETUP_DE_INTERLACE;
  341.                                                                                 SetDeInterlace(val - 2);
  342.                                                                             }
  343. #endif//#ifdef DIP_CFG_ENABLE
  344.                                                         #ifdef VIDEO_SETUP_NEW_GUI//zhaoyanhua add 2004-1-8 16:46
  345.                                                                     if ((id == STR_OS_BRIGHTNESS) ||
  346.                                                                         (id == STR_OS_CONTRAST) ||
  347.                                                                         (id == STR_OS_HUE) ||
  348.                                                                         (id == STR_OS_SATURATION)
  349.                                                                 #ifdef DIP_CFG_ENABLE
  350.                                                                         ||(id == STR_OS_DEINTLC)
  351.                                                                 #endif//#ifdef DIP_CFG_ENABL
  352.                                                                         )
  353.                                                                     {   
  354.                                                                         setup_CookVideoGUIString(id);
  355.                                                                     }
  356.                                                                     else
  357.                                                         #endif//VIDEO_SETUP_NEW_GUI
  358.                                                                             setup_DrawScaleItem(id, 1, val-2);
  359. }
  360. #endif //end of DVD_SETUP_REENG
  361. //=============================================
  362. //for DVD_SETUP_REENG   //added by JS   //20040728
  363. #if 0//ndef DVD_SETUP_REENG
  364. //
  365. // setup_PrepareScaleItem   : draw scale item, including rectangle, and blank calibration
  366. //
  367. // input    :   id      -> scale item string id
  368. //              up1down -> 0:up state
  369. //                      -> 1:down state
  370. //
  371. void setup_PrepareScaleItem(BYTE id, BYTE up1down)
  372. {
  373.     BYTE    uColor, dColor; //up, down
  374.     BYTE    fontColor, bgColor; //font, background color
  375.     UINT32  xStart, yStart;
  376.     UINT32  yDelta=0;
  377.     BYTE    buf[15];
  378.     BYTE    xWidth;
  379.     int val = echo_level; // give a default value
  380.     if (up1down) {
  381.         uColor = SBLACKCOLOR;
  382.         dColor = SWHITECOLOR;
  383.         #ifdef QSI_SETUP_MENU_DESIGN//liweihua 2004-7-4 17:45
  384.         fontColor = SFONTCOLOR;
  385.         #else
  386.         fontColor = SANTIFONTCOLOR;
  387.         #endif//#ifdef QSI_SETUP_MENU_DESIGN
  388.     #ifdef HL_CURSOR_ONLY//only hilight cursor ,not whole SCALE.zhaoyanhua add 2003-12-16 10:17
  389.         bgColor = SBGCOLOR;
  390.     #else
  391.         bgColor = SANTIBGCOLOR;
  392.     #endif
  393.     } else {
  394.         uColor = SWHITECOLOR;
  395.         dColor = SBLACKCOLOR;
  396.         fontColor = SFONTCOLOR;
  397.         bgColor = SBGCOLOR;
  398.     }
  399.     xStart = SETUP_SUB_XSTART*16;
  400.     yStart = SETUP_MENU_YSTART*SETUP_BUTTON_HEIGHT+32;
  401.     xWidth = 14;
  402.     if (id==STR_OS_ECHO) {
  403.         static const t_osd_str osdstr_echo[] = {
  404.                         { SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, " -    - 8"},
  405.                         { SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, " -    - 6"},
  406.                         { SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, " -    - 4"},
  407.                         { SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, " -    - 2"},
  408.                         { SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, " -    - OFF"},
  409.                         { 0, 0, NULL}
  410.                     };
  411.         //echo_level(0 ~ 8)
  412.         yDelta = 5 * SETUP_BUTTON_HEIGHT;
  413.         //draw area bgcolor
  414.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  415.         //draw strings
  416.         osd_DrawStrings(osdstr_echo, fontColor, bgColor);
  417.         // 
  418.         val=echo_level;
  419.     } else
  420. #ifdef  Ti3001_OSD_UI_2
  421.     if ((id==STR_OS_AMP_MAINVOLUME)||(id==STR_OS_AMP_FSPK)||(id==STR_OS_AMP_FSPK_BALANCE)||
  422.                 (id==STR_OS_AMP_SSPK)||(id==STR_OS_AMP_SSPK_BALANCE)||(id==STR_OS_AMP_CSPK)||(id==STR_OS_AMP_SUBWOOFER))
  423.     {
  424.         //level(1 ~ 15)
  425.         yDelta =8 * SETUP_BUTTON_HEIGHT-1;    //   减1是为消去最下面的一条线。2-8-25 14:59 GERRY
  426.         //draw area bgcolor
  427.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  428.         //draw calibration
  429.         //psprintf(buf, " -    +");
  430.         static t_osd_str osdstr_vol[] = {
  431.                     SETUP_SUB_X_START+1, SETUP_MENU_YSTART+0, " -    - +10DB",
  432.                     SETUP_SUB_X_START+1, SETUP_MENU_YSTART+1, " -    -   0",
  433.                     SETUP_SUB_X_START+1, SETUP_MENU_YSTART+2, " -    -  -10",
  434.                     SETUP_SUB_X_START+1, SETUP_MENU_YSTART+3, " -    -  -20",
  435.                     SETUP_SUB_X_START+1, SETUP_MENU_YSTART+4, " -    -  -30",
  436.                     SETUP_SUB_X_START+1, SETUP_MENU_YSTART+5, " -    -  -40",
  437.                     SETUP_SUB_X_START+1, SETUP_MENU_YSTART+6, " -    - -50DB",
  438.                     SETUP_SUB_X_START+1, SETUP_MENU_YSTART+7, " -    -  OFF",
  439.                                     0, 0, NULL
  440.                                 };
  441.         osd_DrawStrings(osdstr_vol, fontColor, bgColor);
  442.         if (id==STR_OS_AMP_MAINVOLUME)
  443.         {
  444.             val=amp_volume_level;
  445.         }else
  446.         if (id==STR_OS_AMP_FSPK)
  447.         {
  448.             val=amp_fspk_level;
  449.         }else
  450.         if (id==STR_OS_AMP_FSPK_BALANCE)
  451.         {
  452.             val=amp_fspk_balance_level;
  453.         }else
  454.         if (id==STR_OS_AMP_SSPK)
  455.         {
  456.             val=amp_sspk_level;
  457.         }else
  458.         if (id==STR_OS_AMP_SSPK_BALANCE)
  459.         {
  460.             val=amp_sspk_balance_level;
  461.         }else
  462.         if (id==STR_OS_AMP_CSPK)
  463.         {
  464.             val=amp_cspk_level;
  465.         }else
  466.         if (id==STR_OS_AMP_SUBWOOFER)
  467.         {
  468.             val=amp_subwoofer_level;
  469.         }
  470.     } else
  471.     if ((id==STR_OS_AMP_BASS)||(id==STR_OS_AMP_TREMBLE))      //低音和高音。 2-8-25 15:10 GERRY
  472.     {
  473.         //level(1 ~ 15)
  474.         yDelta =7 * SETUP_BUTTON_HEIGHT;
  475.         //draw area bgcolor
  476.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  477.         //draw calibration
  478.         //psprintf(buf, " -    +");
  479.         psprintf(buf, " -    - +18DB");
  480.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART, buf, fontColor, bgColor);
  481.         psprintf(buf, " -    -   12");
  482.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, buf, fontColor, bgColor);
  483.         psprintf(buf, " -    -   6");
  484.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, buf, fontColor, bgColor);
  485.         psprintf(buf, " -    -   0");
  486.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, buf, fontColor, bgColor);
  487.         psprintf(buf, " -    -  -6");
  488.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, buf, fontColor, bgColor);
  489.         psprintf(buf, " -    -  -12");
  490.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, buf, fontColor, bgColor);
  491.         psprintf(buf, " -    - -18DB");
  492.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, buf, fontColor, bgColor);
  493.         // psprintf(buf, " -    - -60");
  494.         //osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, buf, fontColor, bgColor);
  495.         //psprintf(buf, " -    - -18DB");
  496.         //osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, buf, fontColor, bgColor);
  497.         if (id==STR_OS_AMP_BASS)
  498.         {
  499.             val=amp_bass_level;
  500.         }
  501.         else
  502.         {
  503.             val=amp_tremble_level;
  504.         }
  505.     } else
  506.     if (id==STR_OS_AMP_DYNAMICRANGE)     //动态范围    2-8-25 15:08  GERRY
  507.     {
  508.         //level(1 ~ 15)
  509.         yDelta =7 * SETUP_BUTTON_HEIGHT;
  510.         //draw area bgcolor
  511.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  512.         //draw calibration
  513.         //psprintf(buf, " -    +");
  514.         psprintf(buf, " -    -  0DB");
  515.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART, buf, fontColor, bgColor);
  516.         psprintf(buf, " -    -  -6");
  517.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, buf, fontColor, bgColor);
  518.         psprintf(buf, " -    -  -12");
  519.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, buf, fontColor, bgColor);
  520.         psprintf(buf, " -    -  -18");
  521.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, buf, fontColor, bgColor);
  522.         psprintf(buf, " -    -  -24");
  523.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, buf, fontColor, bgColor);
  524.         psprintf(buf, " -    -  -32");
  525.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, buf, fontColor, bgColor);
  526.         psprintf(buf, " -    - -36DB");
  527.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, buf, fontColor, bgColor);
  528.         // psprintf(buf, " -    - -60");
  529.         //osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, buf, fontColor, bgColor);
  530.         //psprintf(buf, " -    - -36DB");
  531.         //osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, buf, fontColor, bgColor);
  532.         val=amp_dynamic_level;
  533.     } else
  534. #endif
  535.     if (id==STR_OS_KEY) {
  536.         static t_osd_str osdstr_key[] = {
  537.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, " -    " Ch_ukey}, 
  538.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, " -    - +4"},
  539.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, " -    - +2"},
  540.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, " -    -  0"},
  541.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, " -    - -2"},
  542.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, " -    - -4"},
  543.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, " -    " Ch_dkey}, 
  544.             {0, 0, NULL},
  545.         };
  546.         //audio_key(-6 ~ 6)
  547.         yDelta = 7 * SETUP_BUTTON_HEIGHT;
  548.         //draw area bgcolor
  549.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  550.         //draw calibration
  551.         osd_DrawStrings(osdstr_key, fontColor, bgColor);
  552.         val=audio_key;
  553.     }else
  554.     if ( (id==STR_OS_FSPK) || (id==STR_OS_CSPK) || (id==STR_OS_SSPK)||(id==STR_OS_MIC_VOL)||(id==STR_OS_MIC_VOL_1)|| (id==STR_OS_MIC_VOL_2))
  555.     {
  556.         if(id!=STR_OS_MIC_VOL&&id!=STR_OS_MIC_VOL_1&&id!=STR_OS_MIC_VOL_2)
  557.             yStart = SETUP_MENU_YSTART*SETUP_BUTTON_HEIGHT+32;//wanghaoying 2003-12-1 21:57
  558.         //spk_volume(0 ~ 8)
  559.         yDelta = 5 * SETUP_BUTTON_HEIGHT;
  560.         //draw area bgcolor
  561.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  562.         //draw calibration
  563.         psprintf(buf, " -    - 8");
  564.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, buf, fontColor, bgColor);
  565.         buf[8]='6';//psprintf(buf, " -    - 6");
  566.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, buf, fontColor, bgColor);
  567.         buf[8]='4';//psprintf(buf, " -    - 4");
  568.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, buf, fontColor, bgColor);
  569.         buf[8]='2';//psprintf(buf, " -    - 2");
  570.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, buf, fontColor, bgColor);
  571.         psprintf(buf, " -    - OFF");
  572.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, buf, fontColor, bgColor);
  573. #ifndef AC3_BASS_MANAGEMENT
  574.         if (id==STR_OS_FSPK) {
  575.             val=SETUP_SPK_FRONT-2;
  576.         } else
  577.         if (id==STR_OS_CSPK) {
  578.             val=SETUP_SPK_CENTER-2;
  579.         } else
  580.         if (id==STR_OS_SSPK) {
  581.             val=SETUP_SPK_SURROUND-2;
  582.         }else
  583. #endif
  584.         {//wangfeng 2003-09-12 21:36
  585.             #ifdef  MIC_2CHANNEL
  586.             if(id==STR_OS_MIC_VOL||id==STR_OS_MIC_VOL_1)
  587.                 mic_volume=SETUP_MIC_VOL-2;
  588.             else if(id==STR_OS_MIC_VOL_2)
  589.                 mic_volume=SETUP_MIC_VOL_2-2;
  590.             #endif
  591.             val=mic_volume;
  592.         }
  593.                                             
  594.     } else
  595.     if (id==STR_OS_CSPK_DELAY) {
  596.         //center speaker delay 0 ~ 5 ms(step=1)
  597.         yStart = (SETUP_MENU_YSTART+3)*SETUP_BUTTON_HEIGHT;
  598.         yDelta = 4 * SETUP_BUTTON_HEIGHT;
  599.         //draw area bgcolor
  600.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  601.         //draw calibration
  602.         #ifdef NO_SHOW_ADD_ICON   //fengjl add 3-11-28 23:32
  603.             #ifdef  SHOW_SPK_DELAY_BY_DISTANCE  //Maoyong 2004.04.21
  604.             psprintf(buf, " -    - 180CM");
  605.             #else       
  606.             psprintf(buf, " -    - 6 MS");      
  607.             #endif
  608.         #else   //#ifdef NO_SHOW_ADD_ICON   
  609.         psprintf(buf, " -    - +");
  610.         #endif  //#ifdef NO_SHOW_ADD_ICON
  611.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, buf, fontColor, bgColor);
  612.         
  613.         #ifdef AD_TCL//2004-3-22 13:04 lijd
  614.         psprintf(buf, " -    - 4 %s",Ch_zu);
  615.         #elif defined(SHOW_SPK_DELAY_BY_DISTANCE)   //Maoyong 2004.04.21
  616.         psprintf(buf, " -    - 120CM");
  617.         #else
  618.         psprintf(buf, " -    - 4 MS");
  619.         #endif
  620.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, buf, fontColor, bgColor);
  621.         
  622.         #if defined(SHOW_SPK_DELAY_BY_DISTANCE) //Maoyong 2004.04.21
  623.         psprintf(buf, " -    - 60 CM");
  624.         #else
  625.         buf[8]='2';//psprintf(buf, " -    - 2 MS");
  626.         #endif
  627.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, buf, fontColor, bgColor);
  628.         
  629.         #if defined(SHOW_SPK_DELAY_BY_DISTANCE) //Maoyong 2004.04.21
  630.         psprintf(buf, " -    - 0  CM");
  631.         #else
  632.         buf[8]='0';//psprintf(buf, " -    - 2 MS");
  633.         #endif
  634.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, buf, fontColor, bgColor);
  635.         val=SETUP_SPK_CENTER_DELAY-2;
  636.     } else
  637.     #ifdef ADD_DVI311_SETUP
  638.     if (id==STR_OS_DVI311_MODE) {
  639.         yStart = (SETUP_MENU_YSTART+1)*SETUP_BUTTON_HEIGHT;
  640.         //ac3_dynarange(0 ~ 8)
  641.         yDelta = 7 * SETUP_BUTTON_HEIGHT;
  642.         //draw area bgcolor
  643.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  644.         //draw calibration
  645.         psprintf(buf, " VGA    6OHZ");
  646.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, buf, fontColor, bgColor);
  647.         psprintf(buf, "SVGA    60HZ");
  648.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, buf, fontColor, bgColor);
  649.         psprintf(buf, " XGA    60HZ");
  650.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, buf, fontColor, bgColor);
  651.         psprintf(buf, "SXGA    60HZ");
  652.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, buf, fontColor, bgColor);
  653.         //kevin @2k40514
  654.         if(dvi311_tv_mode==0x84) //PAL
  655.         psprintf(buf, "            ");
  656.         else
  657.         psprintf(buf, "480P    60HZ");
  658.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, buf, fontColor, bgColor);
  659.         if(dvi311_tv_mode>0x84) //PAL60&NTSC
  660.         psprintf(buf, "            ");
  661.         else
  662.         psprintf(buf, "576P    50HZ");      
  663.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, buf, fontColor, bgColor);
  664.         if(dvi311_tv_mode>0x84) //PAL60&NTSC
  665.         psprintf(buf, "720P    60HZ");
  666.         else
  667.         psprintf(buf, "720P    50HZ");      
  668. //      osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, buf, fontColor, bgColor);
  669. //      psprintf(buf, "720P    60HZ");
  670.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, buf, fontColor, bgColor);
  671.         //val=SETUP_AC3DIGITAL_DYNA-2;
  672.         val=dvi311_mode;
  673.         }
  674. #endif
  675.     if (id==STR_OS_DYNAMICRANGE) { //Jeff 20020604
  676.         //ac3_dynarange:0~8
  677.         yStart = (SETUP_MENU_YSTART+1)*SETUP_BUTTON_HEIGHT;
  678.         //ac3_dynarange(0 ~ 8)
  679.         yDelta = 5 * SETUP_BUTTON_HEIGHT;
  680.         //draw area bgcolor
  681.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  682.         //draw calibration
  683.         psprintf(buf, " -    - FULL");
  684.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, buf, fontColor, bgColor);
  685.         psprintf(buf, " -    - 6/8");
  686.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, buf, fontColor, bgColor);
  687.         psprintf(buf, " -    - 4/8");
  688.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, buf, fontColor, bgColor);
  689.         psprintf(buf, " -    - 2/8");
  690.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, buf, fontColor, bgColor);
  691.         psprintf(buf, " -    - OFF");
  692.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, buf, fontColor, bgColor);
  693.         val=SETUP_AC3DIGITAL_DYNA-2;
  694.     } else if (id==STR_OS_SSPK_DELAY)
  695.     {
  696.         //surround speaker delay 0 ~ 15 ms(step=3)
  697.         yStart = (SETUP_MENU_YSTART+3)*SETUP_BUTTON_HEIGHT;
  698.         //spk_volume(0 ~ 8)
  699.         yDelta = 4 * SETUP_BUTTON_HEIGHT;
  700.         //draw area bgcolor
  701.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  702.         //draw calibration
  703.         #ifdef NO_SHOW_ADD_ICON   //fengjl add 3-11-28 23:32
  704.             #ifdef  SHOW_SPK_DELAY_BY_DISTANCE  //Maoyong 2004.04.21
  705.             psprintf(buf, " -    - 540CM");
  706.             #else       
  707.             psprintf(buf, " -    - 18 MS");     
  708.             #endif
  709.         #else   //NO_SHOW_ADD_ICON
  710.         psprintf(buf, " -    - +");
  711.         #endif  //NO_SHOW_ADD_ICON                                  
  712.         
  713.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, buf, fontColor, bgColor);
  714.         
  715.         #ifdef AD_TCL//2004-3-22 13:05 lijd
  716.         psprintf(buf, " -    - 12 %s",Ch_zu);
  717.         #elif defined(SHOW_SPK_DELAY_BY_DISTANCE)   //Maoyong 2004.04.21
  718.         psprintf(buf, " -    - 360CM");
  719.         #else
  720.         psprintf(buf, " -    - 12 MS");
  721.         #endif
  722.         
  723.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, buf, fontColor, bgColor);
  724.         
  725.         #ifdef AD_TCL//2004-3-22 13:06 lijd
  726.         psprintf(buf, " -    - 6 %s",Ch_zu);
  727.         #elif defined(SHOW_SPK_DELAY_BY_DISTANCE)   //Maoyong 2004.04.21
  728.         psprintf(buf, " -    - 180CM");
  729.         #else
  730.         psprintf(buf, " -    - 6 MS");
  731.         #endif
  732.         
  733.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, buf, fontColor, bgColor);
  734.         #ifdef SHOW_SPK_DELAY_BY_DISTANCE   //Maoyong 2004.04.21
  735.         psprintf(buf, " -    - 0  CM");
  736.         #else
  737.         buf[8]='0';//psprintf(buf, " -    - 0 MS");
  738.         #endif  
  739.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, buf, fontColor, bgColor);
  740.         val=SETUP_SPK_SURROUND_DELAY-2;
  741.     }
  742.     else if (id==STR_OS_BRIGHTNESS)
  743.     {
  744.         static const t_osd_str osdstr_brightness[] = {
  745.                 {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, " -    -  12"},
  746.                 {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, " -    -  10"},
  747.                 {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, " -    -   8"},
  748.                 {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, " -    -   6"},
  749.                 {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, " -    -   4"},
  750.                 {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, " -    -   2"},
  751.                 {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, " -    -   0"},
  752.                 {0, 0, NULL}
  753.                 };
  754.         yDelta = 7 * SETUP_BUTTON_HEIGHT;
  755.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  756.         osd_DrawStrings(osdstr_brightness, fontColor, bgColor);
  757.         val = SETUP_BRIGHTNESS - 2;
  758.     }
  759.     else if (id==STR_OS_CONTRAST)
  760.     {
  761.         static const t_osd_str osdstr_contrast[] = {
  762.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, " -    -  12"},
  763.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, " -    -  10"},
  764.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, " -    -   8"},
  765.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, " -    -   6"},
  766.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, " -    -   4"},
  767.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, " -    -   2"},
  768.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, " -    -   0"},
  769.             {0, 0, NULL}
  770.         };
  771.         yDelta = 7 * SETUP_BUTTON_HEIGHT;
  772.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  773.         osd_DrawStrings(osdstr_contrast, fontColor, bgColor);
  774.         val = SETUP_CONTRAST - 2;
  775.     }
  776.     else if (id==STR_OS_HUE)
  777.     {
  778.         static const t_osd_str osdstr_hue[] = {
  779.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, " -    -  +6"},
  780.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, " -    -  +4"},
  781.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, " -    -  +2"},
  782.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, " -    -   0"},
  783.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, " -    -  -2"},
  784.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, " -    -  -4"},
  785.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, " -    -  -6"},
  786.             {0, 0, NULL}
  787.         };
  788.         yDelta = 7 * SETUP_BUTTON_HEIGHT;
  789.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  790.         osd_DrawStrings(osdstr_hue, fontColor, bgColor);
  791.         val = SETUP_HUE - 2;
  792.     }
  793.     else if (id==STR_OS_SATURATION)
  794.     {
  795.         static const t_osd_str osdstr_saturation[] = {
  796.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+1, " -    -  12"},
  797.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, " -    -  10"},
  798.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, " -    -   8"},
  799.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, " -    -   6"},
  800.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, " -    -   4"},
  801.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+6, " -    -   2"},
  802.             {SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+7, " -    -   0"},
  803.             {0, 0, NULL}
  804.         };
  805.         yDelta = 7 * SETUP_BUTTON_HEIGHT;
  806.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  807.         osd_DrawStrings(osdstr_saturation, fontColor, bgColor);
  808.         val = SETUP_SATURATION - 2;
  809.     }
  810. #ifdef DIP_CFG_ENABLE
  811.     else if (id==STR_OS_DEINTLC)
  812.     {
  813.         yStart = (SETUP_MENU_YSTART+2)*SETUP_BUTTON_HEIGHT;
  814.         yDelta = 4 * SETUP_BUTTON_HEIGHT;
  815.         osd_draw_rect(xStart, yStart, xWidth*16, yDelta, bgColor);
  816.         psprintf(buf, " -    -   6");
  817.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+2, buf, fontColor, bgColor);
  818.         psprintf(buf, " -    -   4");
  819.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+3, buf, fontColor, bgColor);
  820.         psprintf(buf, " -    -   2");
  821.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+4, buf, fontColor, bgColor);
  822.         psprintf(buf, " -    -   0");
  823.         osd_DrawString(SETUP_SUB_XSTART+1, SETUP_MENU_YSTART+5, buf, fontColor, bgColor);
  824.         val = SETUP_DE_INTERLACE- 2;
  825.     }
  826. #endif//#ifdef DIP_CFG_ENABLE
  827.     setup_DrawScaleItem(id, up1down, val);
  828.     //top
  829.     if (p_scan==1)
  830.         osd_DrawLine(xStart, yStart, xStart+xWidth*16, yStart, uColor, 2);
  831.     else
  832.         osd_DrawLine(xStart, yStart, xStart+xWidth*16, yStart, uColor, 1);
  833.     //left
  834.     osd_DrawLine(xStart, yStart, xStart, yStart+yDelta, uColor, 1);
  835.     //bottom
  836.     if (p_scan==1)
  837.         osd_DrawLine(xStart, yStart+yDelta, xStart+xWidth*16, yStart+yDelta, dColor, 2);
  838.     else
  839.         osd_DrawLine(xStart, yStart+yDelta, xStart+xWidth*16, yStart+yDelta, dColor, 1);
  840.     //right
  841.     osd_DrawLine(xStart+xWidth*16, yStart, xStart+xWidth*16, yStart+yDelta, dColor, 1);
  842. }
  843. #endif //end of DVD_SETUP_REENG
  844. //Jeff 20031110
  845. // 2004/01/30 yltseng, these should reference to 'const' variable
  846. #ifdef  VOL_80  
  847. extern const BYTE  VolTab[17+65];
  848. #elif defined(VOL_20)     //fengjl add 2004-03-08 21:38
  849. extern const BYTE  VolTab[22];
  850. #else
  851. extern const BYTE  VolTab[17];
  852. #endif
  853. extern const BYTE  MICVolTab[9];
  854. //
  855. // setupGetSetting : to get some system setting about audio for DSP initialization
  856. //
  857. UINT32 setupGetSetting(BYTE x)
  858. {
  859.     UINT32  iVal=0;
  860.     BYTE    sel;
  861.     UINT16 P, I;
  862.     switch (x) {
  863.     case 3:     //Time of Mic auto on after sound detect on
  864.         iVal = MIC_PRESENSITIVITY;
  865.         break;
  866.     case 4:     //Time of Mic auto off after sound detect off
  867.         iVal = MIC_AFTERSENSITIVITY;
  868.         break;
  869.     case 5:     //Mic sound detect gain threshold
  870.         iVal = MIC_THRESHOLD;
  871.         break;
  872.     case 6:     //Mic switch    // output: 0->off,  1-> on, 2->auto
  873.             #if  defined(NOT_SHOW_MIC_SETUP_DAFAULT_AUTO)
  874.                 iVal = 2;
  875.             #elif defined(NO_MIC)
  876.                 iVal = 0;
  877.             #else
  878.                 P=setup_getItemPos(STR_OS_MIC_ONOFF);
  879.                 I=P&0xff;
  880.                 P=P>>8;
  881.                 if(setup_item[P][I][setup_VA[SETUP_VA_MIC_ONOFF]] == STR_OS_OFF)
  882.                 {
  883.                     iVal = 0;   // off
  884.                 }
  885.                 else if(setup_item[P][I][setup_VA[SETUP_VA_MIC_ONOFF]] == STR_OS_ON)
  886.                 {
  887.                     iVal = 1;
  888.                 }
  889.                 else if(setup_item[P][I][setup_VA[SETUP_VA_MIC_ONOFF]] == STR_OS_AUTO)
  890.                 {
  891.                     iVal = 2;
  892.                 }
  893.                 setup_sel[P][I] = setup_VA[SETUP_VA_MIC_ONOFF];
  894.             #endif
  895.         break;
  896. /******************************************************************************
  897.     case 6:     //Mic switch
  898.     #ifdef NOT_SHOW_MIC_SETUP_DAFAULT_AUTO//nono 4-1-11 18:52
  899.             sel = 0;
  900.     #else
  901.         sel = setup_VA[SETUP_VA_MIC_ONOFF]-MIN_ITEM_SEL;//SETUP_MIC_ONF-2;
  902.     #endif//NOT_SHOW_MIC_SETUP_DAFAULT_AUTO
  903. #ifdef DVDRELEASE
  904.         //setup :   0->auto, 1->off
  905.         //output:   0->off,  1->on, others:auto
  906.         if (sel == 0) {     //auto
  907.             iVal = 2;
  908. #ifndef NOT_SHOW_MIC_SETUP_DAFAULT_AUTO
  909.             setup_VA[SETUP_VA_MIC_ONOFF]=MIN_ITEM_SEL;//SETUP_MIC_ONF = 2;
  910. #endif//#ifdef NOT_SHOW_MIC_SETUP_DAFAULT_AUTO
  911.         }
  912.         else 
  913.         {
  914.             #if defined(NO_MIC)  //fengjl add to avoid mic output when define no_mic 2004-03-19 11:45
  915.             {
  916.                 iVal = 0; //off
  917.             }
  918.             #else
  919.             {            //off
  920.             iVal = 0;
  921.             setup_VA[SETUP_VA_MIC_ONOFF] = 3;
  922.         }
  923.             #endif
  924.         }
  925.         //printf("release:SETUP_MIC_ONF = %d, iVal=%dn", SETUP_MIC_ONF, iVal);
  926. #else
  927.         //setup :   0->auto, 1->on, 2->off
  928.         //output:   0->off,  1->on, others:auto
  929.         if (sel == 0) {     //auto
  930.             iVal = 2;
  931.             setup_VA[SETUP_VA_MIC_ONOFF] = 2;
  932.         } else if (sel == 1) {     //on
  933.             iVal = 1;
  934.             setup_VA[SETUP_VA_MIC_ONOFF] = 3;
  935.         } else {
  936.             iVal=0;
  937.             setup_VA[SETUP_VA_MIC_ONOFF] = 4;
  938.         }
  939.         //printf("debug:SETUP_MIC_ONF = %d, iVal=%dn", SETUP_MIC_ONF, iVal);
  940. #endif
  941.     P=setup_getItemPos(STR_OS_MIC_ONOFF);
  942.     I=P&0xff;
  943.     P=P>>8;
  944.     setup_sel[P][I]=setup_VA[SETUP_VA_MIC_ONOFF];
  945.         break;
  946. *******************************************************************************/
  947.     case 7:     //Audio gain
  948.         if (user_mute) {
  949.             iVal=0x7fffff;
  950.         } else
  951.         {
  952.             //iVal=0x7fffff-(audio_volume*0x7fffff/VOL_VALUE);
  953.             #ifdef CNTR_5SPK_VOLUME
  954.             //iVal=0x7fffff-(volume_5SPK[0]*0x7fffff/VOL_VALUE);
  955.               iVal=0x7fffff - ( (VolTab[volume_5SPK[0]]<<16) | 0xffff); //Jeff 20031114
  956.             #else
  957.             //iVal=0x7fffff-(audio_volume*0x7fffff/VOL_VALUE);
  958.             iVal=0x7fffff-( (VolTab[audio_volume]<<16) | 0xffff); //Jeff 20031114
  959.             #endif
  960.         }
  961.         break;
  962.     case 44: //MIC-2 gain, if we want to set different gain, we can seperate these two, Jeff 20030901
  963.     case 8:     //MIC gain
  964. #ifdef NO_MIC
  965.     #ifdef NO_MIC_ITEM_ENABLE_MIC       //kubby add for BBK_DVD,3-10-19 23:07
  966.         //iVal=0x7fffff-(mic_volume*0x7fffff/8);
  967.         iVal = 0x7fffff - ( (MICVolTab[mic_volume]<<16) | 0xffff); //Jeff 20031110
  968.     #else
  969.         iVal=0x7fffff;
  970.     #endif
  971. #else
  972.         //iVal=0x7fffff-(mic_volume*0x7fffff/8);
  973.         iVal = 0x7fffff - (( MICVolTab[mic_volume]<<16) | 0xffff); //Jeff 20031110
  974. #endif
  975. /*huziqin 2004-3-5*/
  976. //#ifdef SUPPORT_RECEIVER
  977.     //iVal = (0x7fffff-(( MICVolTab[8]<<16) | 0xffff)); 
  978. //#endif
  979.         break;
  980.     case 9:     //Key shift
  981.         iVal = audio_key+8;
  982.         break;
  983.     case 10:    //Echo delay
  984. #ifdef USE_MIC_ECHO_PARAM
  985.                  iVal = echo_para_tbl[echo_level][1];//2004AUDDRV echo_para[echo_level][1];
  986. #else
  987.         iVal = echo_level;
  988. #endif
  989.         break;
  990.     case 11:    //Echo gain
  991. #ifdef USE_MIC_ECHO_PARAM
  992.         iVal = echo_para_tbl[echo_level][0];//2004AUDDRV echo_para[echo_level][0];
  993. #else
  994.         iVal = ECHO_DECAY_INIT;
  995. #endif
  996.         break;
  997.     case 12:    //3D surround
  998.         iVal = soundGetSurroundType();  //0:off other:different type
  999.         break;
  1000.     case 13:    //subwoof
  1001.     #ifdef ONLY_DOWNMIX//4-1-15 18:31
  1002.         iVal = 0;
  1003.     #else//ONLY_DOWNMIX
  1004.     
  1005.         sel=setup_VA[SETUP_VA_SUBWOOFER]-MIN_ITEM_SEL;//SETUP_SPK_SUBWOOFER-2;
  1006.         iVal = sel;
  1007.     #endif//ONLY_DOWNMIX
  1008.         break;
  1009.     case 14: //S/PDIF,terry,2003/12/12 06:13PM
  1010.                 //bbk setup:2->source,  3->PCM
  1011.                 //setup:    2:spdif off 3->source,  4->PCM
  1012.         //output:   0->0ff,     1->PCM,         2->source           
  1013. #ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1014.         if(coding_mode_now&(AUDIF_CODING_MODE_AC3))
  1015.         {
  1016.             P=setup_getItemPos(STR_OS_AUD_OUT);
  1017.             I=P&0xff;
  1018.             P=P>>8;
  1019.             if(setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_BITSTREAM)//SETUP_SPDIF == SPDIFBITSTREAM)
  1020.                 iVal = 2;
  1021.             else if(setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_STEREO_PCM)//SETUP_SPDIF == SPDIFPCM)
  1022.                 iVal = 1;
  1023.             else
  1024.                 iVal = 0;
  1025.             
  1026.         }else if ((coding_mode_now&(AUDIF_CODING_MODE_DTS ) )|| ((cd_type_loaded==CDDA) && (cd_subtype==CD_DTS)) )        
  1027.         {
  1028.         //denghangao 20040929 add "{}"
  1029.             P=setup_getItemPos(STR_OS_DTS_DIGITAL);
  1030.             I=P&0xff;
  1031.             P=P>>8;
  1032.             if(setup_item[P][I][setup_VA[SETUP_VA_DTS_DIGITAL]]==STR_OS_BITSTREAM)//SETUP_SPDIF_DTS == SPDIFBITSTREAM)
  1033.                 iVal = 2;
  1034.             else
  1035.                 iVal = 0;
  1036.         }
  1037.         else
  1038.         {
  1039.             P=setup_getItemPos(STR_OS_AUD_OUT);
  1040.             I=P&0xff;
  1041.             P=P>>8;
  1042.                 if(setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_BITSTREAM)//SETUP_SPDIF_PCM==SPDIFBITSTREAM)  
  1043.                     iVal = 1;
  1044.                 else
  1045.                     iVal = 0;
  1046.         }
  1047. #else//DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1048.     P=setup_getItemPos(STR_OS_AUD_OUT);
  1049.     I=P&0xff;
  1050.     P=P>>8;
  1051.     if(setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_BITSTREAM)//SETUP_SPDIF == SPDIFBITSTREAM)
  1052.         iVal = 2;
  1053.     else if(setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_STEREO_PCM)//SETUP_SPDIF == SPDIFPCM)
  1054.         iVal = 1;
  1055.     else
  1056.         iVal = 0;
  1057. #endif//DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1058. #ifdef NO_DTS_OUTPUT
  1059.   #ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1060.     P=setup_getItemPos(STR_OS_DTS_DIGITAL);
  1061.     I=P&0xff;
  1062.     P=P>>8;
  1063.   #endif//#ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS  
  1064.         if ( 
  1065.             ((cd_type_loaded == CDDA) && (cd_subtype == CD_DTS))
  1066. #ifdef FORCE_NO_DTS_OUTPUT//nono 4-5-5 13:31
  1067.             ||(coding_mode_now&AUDIF_CODING_MODE_DTS) 
  1068. #endif//#ifdef FORCE_NO_DTS_OUTPUT
  1069. #ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1070.             &&(setup_item[P][I][setup_VA[SETUP_VA_DTS_DIGITAL]]==STR_OS_BITSTREAM)//SETUP_SPDIF_DTS==SPDIFBITSTREAM)
  1071. #endif//#ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1072.            )
  1073.             iVal = 2;
  1074. #endif//#ifdef NO_DTS_OUTPUT
  1075.     #if defined(NO_SPDIF)//nono 20031027
  1076.         iVal = 0;
  1077.     #endif//NO_SPDIF
  1078.         printf("===>spdif out:%xn",iVal);
  1079.         break;
  1080. #ifdef LPCM_NO_SHOW_BAND  //fengjl add 2004-03-19 18:51
  1081.     case 15:    //EQ            ,terry,2003/9/26 04:51PM
  1082.         if(coding_mode_now==AUDIF_CODING_MODE_LPCM)//2004-03-19 18:30
  1083.         //iVal = bEqDisplay;
  1084.         iVal = 0;
  1085.         break;
  1086. #endif
  1087.     case 16:
  1088.         if (coding_mode_now==AUDIF_CODING_MODE_AC3) {
  1089.             iVal = 1;
  1090.         } else if (coding_mode_now==AUDIF_CODING_MODE_DTS) {
  1091.             iVal = 11;
  1092.         } else {
  1093.             iVal = 0;
  1094.         }
  1095.         break;
  1096. #ifdef AC3_BASS_MANAGEMENT
  1097.     case 27: //Jeff 20021030
  1098.         #ifdef ONLY_DOWNMIX//4-1-15 18:31
  1099.         iVal = 0;
  1100.         #elif defined(SET_FCR_SPEAKER)//XYY changed 2004-10-23 10:48
  1101.         iVal = setup_VA[setup_VA_FRONT_SPEAKER]-MIN_ITEM_SEL;//SETUP_FRONT_SPEAKER -2;   //xulf 2004-01-05   
  1102.         #elif defined(TEST_BASS_MANAGEMENT) //Andrew Wen 20040803
  1103.         // use SPK setting to find config and setting value, set into to word 27                
  1104.         iVal = AUDIF_Get_BassConfig();//2004AUDDRV SetBassConfig();                
  1105.         #else//ONLY_DOWNMIX
  1106.         iVal = setup_VA[SETUP_VA_BASE_MODE]-MIN_ITEM_SEL;//SETUP_BASS_MODE-2;
  1107.         #endif//ONLY_DOWNMIX
  1108.         break;
  1109. #endif
  1110.     case 32:
  1111.         break;
  1112.     case 33:
  1113.         {
  1114.         /* 
  1115.          SETUP_SPK_DOWNMIX (2-5)
  1116.          AC3/DTS/LPCM/PPCM multichannel mode downmix mode(0x06-0x09)
  1117.             2 --> Lt/Rt         0x08
  1118.             3 --> Lo/Ro         0x07
  1119.             4 --> Ls/Rs         0x09
  1120.             5 --> 5.1 channel   0x06
  1121.         */
  1122. #ifdef NO_VSURROUND_CHANNEL
  1123.             BYTE downmix_init[4]={0x08,0x07,0x06,0x09};
  1124. #else
  1125.     #ifdef JIEKE_DVD//wangfeng 2003-10-28 11:18
  1126.             BYTE downmix_init[4]={0x08,0x07,0x06,0x09};
  1127.     #else 
  1128.             BYTE downmix_init[4]={0x08,0x07,0x09,0x06};
  1129.     #endif
  1130. #endif
  1131. #ifdef DIG_AND_AUD
  1132.     iVal=0x08;
  1133. #else
  1134.     iVal=downmix_init[setup_VA[SETUP_VA_DOWNMIX]-MIN_ITEM_SEL];//downmix_init[SETUP_SPK_DOWNMIX-2];
  1135. #endif
  1136.             break;
  1137.         }
  1138. #ifdef SUPPORT_PROLOGIC_II
  1139.     case 35:
  1140.     {
  1141.         if (setup_VA[SETUP_VA_PROLOGIC]==MIN_ITEM_SEL)//SETUP_PROLOGIC_II==2)
  1142.         {
  1143.             pl2_init_val=0x137300;
  1144.         } else if (setup_VA[SETUP_VA_PROLOGIC]==MIN_ITEM_SEL+1)//SETUP_PROLOGIC_II==3)
  1145.         {
  1146.             pl2_init_val=0x127300;
  1147.         } else if (setup_VA[SETUP_VA_PROLOGIC]==MIN_ITEM_SEL+2)//SETUP_PROLOGIC_II==4)
  1148.         {
  1149.             pl2_init_val=0x037300;
  1150.         }       
  1151.     if( !check_chipinfo(6) ) 
  1152.         pl2_init_val=0x037300;
  1153.         iVal=pl2_init_val;
  1154.         break;
  1155.     }
  1156. #endif  
  1157.     case 39:    //Left channel gain , Jeff 20030901
  1158.     case 40:    //Right channel gain
  1159.     case 41:    //Left surround channel gain
  1160.     case 42:    //Right surround channel gain
  1161.     case 43:    //Center channel gain
  1162.    
  1163.     #ifdef CNTR_5SPK_VOLUME
  1164.         //iVal=0x7fffff-(volume_5SPK[x-38]*0x7fffff/VOL_VALUE);   //[x-38]:1->left-channel 2...
  1165.         iVal=0x7fffff- ( (VolTab[volume_5SPK[x-38]]<<16) | 0xffff);   //[x-38]:1->left-channel 2...
  1166.     #else
  1167.         iVal=0; //max. volume
  1168.     #endif
  1169.         break;
  1170.      case 46:
  1171.          //Sub-Woofer channel gain, Jeff 20031028
  1172.          //printf("volume_5SPK[x-40]=%dn",volume_5SPK[x-40]);
  1173.     #ifdef CNTR_5SPK_VOLUME
  1174.          //iVal=0x7fffff-(volume_5SPK[x-40]*0x7fffff/VOL_VALUE);   //[x-38]:1->left-channel 2...
  1175.          iVal=0x7fffff- ( (VolTab[volume_5SPK[x-40]]<<16) | 0xffff);   //[x-38]:1->left-channel 2...
  1176.     #endif
  1177.          break;
  1178.     
  1179.     } //switch (x) {
  1180.     return iVal;
  1181. }
  1182. int setup_IsSet2SPDIF_Bitstream()
  1183. {
  1184.     UINT16 P, I;
  1185.     P=setup_getItemPos(STR_OS_AUD_OUT);
  1186.     I=P&0xff;
  1187.     P=P>>8;
  1188.     #ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1189.     UINT16 P2, I2;
  1190.     P2=setup_getItemPos(STR_OS_DTS_DIGITAL);
  1191.     I2=P2&0xff;
  1192.     P2=P2>>8;
  1193.     #endif  
  1194.     
  1195.     if(
  1196.          ( 
  1197.             (setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_BITSTREAM)//(SETUP_SPDIF==SPDIFBITSTREAM) 
  1198. #ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1199.              && (cd_type_loaded==CDDVD)
  1200. #endif//#ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1201.          )
  1202. #ifdef DIVIDE_AC3_DTS_SPDIF_OUTPUTS
  1203.             //||( (SETUP_SPDIF_DTS==SPDIFBITSTREAM) && (cd_type_loaded==CDDVD) )
  1204.             ||((setup_item[P2][I2][setup_VA[SETUP_VA_DTS_DIGITAL]]==STR_OS_BITSTREAM)&& (cd_type_loaded==CDDVD))
  1205. #endif
  1206.        )
  1207.     return 1;
  1208.     
  1209.     if ((coding_mode_now&AUDIF_CODING_MODE_DTS) || cd_subtype==CD_DTS)
  1210.     {
  1211. #ifdef  NO_DTS_OUTPUT
  1212.         return 1;
  1213. #endif
  1214.         if (!check_chipinfo(2)) return 1;
  1215.     }
  1216.     return 0;
  1217. }
  1218. #ifndef DELETE_SPDIF_OFF_ITEM//zhaoyanhua add 2003-12-8 17:36
  1219. int setup_IsSet2SPDIF_OFF()
  1220. {
  1221.     UINT16 P, I;
  1222.     P=setup_getItemPos(STR_OS_AUD_OUT);
  1223.     I=P&0xff;
  1224.     P=P>>8;
  1225.     if (setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_SIMULATE)//(SETUP_SPDIF==SPDIFSIMULATE)
  1226.         return 1;
  1227.     else
  1228.         return 0;
  1229. }
  1230. #endif
  1231. int setup_DTSCD_IsSet2SPDIF_PCMAndOff()//nono 20030816
  1232. {
  1233.     UINT16 P, I;
  1234.     P=setup_getItemPos(STR_OS_AUD_OUT);
  1235.     I=P&0xff;
  1236.     P=P>>8;
  1237. #ifdef DELETE_SPDIF_OFF_ITEM//zhaoyanhau add 2003-12-8 17:53
  1238. #define is_SPDIF_PCMAndOff()    (setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_STEREO_PCM)//(SETUP_SPDIF==SPDIFPCM)
  1239. #elif defined(NO_DTS_OUTPUT)
  1240. #define is_SPDIF_PCMAndOff()    (setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_SIMULATE)//(SETUP_SPDIF==SPDIFSIMULATE)
  1241. #elif defined(DIVIDE_AC3_DTS_SPDIF_OUTPUTS)
  1242.     UINT16 P2, I2;
  1243.     P2=setup_getItemPos(STR_OS_AC3_DIGITAL);
  1244.     I2=P2&0xff;
  1245.     P2=P2>>8;
  1246. #define is_SPDIF_PCMAndOff()    ((setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]]==STR_OS_SIMULATE)||(setup_item[P][I][setup_VA[SETUP_VA_AC3_DIGITAL]]==STR_OS_SIMULATE))
  1247.                                 //(SETUP_SPDIF_PCM==SPDIFSIMULATE || SETUP_SPDIF==SPDIFSIMULATE)
  1248. #else
  1249. #define is_SPDIF_PCMAndOff()    (0)// (SETUP_SPDIF==SPDIFSIMULATE)||(SETUP_SPDIF==SPDIFPCM) )
  1250. #endif
  1251.     if(
  1252.           (is_SPDIF_PCMAndOff() ) &&
  1253.            ( 
  1254.               ( (cd_subtype == CD_DTS)&&(cd_type_loaded == CDDA) )
  1255.               ||(coding_mode_now&AUDIF_CODING_MODE_DTS)
  1256.            )
  1257.       )
  1258.         return 1;
  1259.     else
  1260.         return 0;
  1261. }
  1262. void setup_Set2SPDIF_PCM()
  1263. {
  1264.     //SETUP_SPDIF = SPDIFPCM;
  1265.     //run_save_sel_cmd(AUDPAGE, DIGIOUTITEM);
  1266.     UINT32 P, I, S;
  1267.     P=setup_getSelPos(STR_OS_STEREO_PCM);
  1268.     I=(P>>8)&0xff;
  1269.     S=P&0xff;
  1270.     P=P>>16;
  1271.     setup_VA[SETUP_VA_AUD_OUT]=S;
  1272.     run_save_sel_cmd(setup_VA[SETUP_VA_AUD_OUT], SETUP_VA_AUD_OUT);
  1273. }
  1274. int setup_IsMICoff()
  1275. {
  1276.     int iRes=0;
  1277.     UINT16 P, I;
  1278.     P=setup_getItemPos(STR_OS_MIC_ONOFF);
  1279.     I=P&0xff;
  1280.     P=P>>8;
  1281. #ifdef DVDRELEASE
  1282.     if (setup_item[P][I][setup_VA[SETUP_VA_MIC_ONOFF]]==STR_OS_OFF) iRes=1;
  1283. #else
  1284.     if (setup_item[P][I][setup_VA[SETUP_VA_MIC_ONOFF]]==STR_OS_OFF) iRes=1;
  1285. #endif
  1286.     return iRes;
  1287. }
  1288. #if defined(NEW_PARENTAL_GUI)||defined(MODIFY_PARENTAL_GUI) //zhaoyanhua add 2003-11-28 10:46
  1289. /*
  1290.  * exit parental GUI.
  1291.  */
  1292. void ExitParentalGUI(void)
  1293. {
  1294.     full_scrn = 0;
  1295. #if defined(NEW_PARENTAL_GUI)
  1296.     new_parental_gui = 0;////avoid the error:when TRAY OUT enter SETUP ,show error infomation. 
  1297. #elif defined(MODIFY_PARENTAL_GUI)
  1298.     parental_gui_flag = 0;                    //nono 2004-5-7 0:24
  1299. #endif//defined(MODIFY_PARENTAL_GUI)
  1300. #ifdef DYNAMIC_SPECTRUM    //fengjl 2004-06-23 09:57
  1301. if (band_onoff)         
  1302. {   
  1303.     #ifdef LPCM_NO_SHOW_BAND    
  1304.         if(coding_mode_now!=AUDIF_CODING_MODE_LPCM)  
  1305.     #endif
  1306.         bEqDisplay=1;
  1307.         Show3dspectrum();
  1308. }
  1309. else
  1310. #endif 
  1311. #ifdef SDRAM_16Mb_Mode  //Maoyong 2004.07.03
  1312.     regs0->osd_base_addr=regs0->osdya;
  1313. #endif
  1314.     osd_init();
  1315. //  if(cd_type_loaded==CDDVD)//nono 2004-5-7 0:13
  1316.     nav_param_by_user();
  1317. }
  1318. #endif//#ifdef NEW_PARENTAL_GUI//zhaoyanhua add 2003-11-28 10:46
  1319. #ifdef NEW_PARENTAL_GUI//zhaoyanhua add 2003-11-28 10:46
  1320. /*
  1321.  *  Show password GUI when playing parental disc
  1322.  */
  1323. void ShowPasswordGUI()
  1324. {
  1325.     const char *str;
  1326.     
  1327.     new_parental_gui = 1;
  1328. #if defined(SDRAM_16Mb_Mode)//&&defined(NEW_STYLE_SETUP)
  1329.             //NOTE:
  1330.             //when SDRAM_16M_Mode,ShowTitle() may destroyed 
  1331.             // OSD memory. So must evaluate osd_base_addr again.
  1332.             //zhaoyanhua add 2003-11-10 17:06
  1333.             regs0->osd_base_addr=OSD_BASE_USE_ADDR;//P_BIDIR_LUMA;
  1334.             //clead 2004-3-26 add
  1335. #endif
  1336.     full_scrn = SETUP;
  1337.     osd_init_parental_gui();
  1338.     
  1339.     #ifndef QSI_SETUP_MENU_DESIGN//liweihua 2004-7-2 17:32
  1340.     SetOsdCol(0,0,SANTIBGCOLOR,0xa346ffff);
  1341.     #endif
  1342.     
  1343. #ifdef NEW_PARENTAL_GUI_SHOW_MULTI_LANG   //2004-2-20 09:21张宇M
  1344.     str =_OsdMessegeFont1[osd_font_mode][STR_OS_PASSWORD];   //wsf 2004-2-6 16:50
  1345. #else//NEW_PARENTAL_GUI_SHOW_MULTI_LANG
  1346.     str ="PASSWORD:";//2004-2-20 09:21张宇M 
  1347. #endif//NEW_PARENTAL_GUI_SHOW_MULTI_LANG
  1348.     osd_DrawRegionString(MESSAGE_XSTART, MESSAGE_YSTART, str, MESSAGE_FONT_COLOR, MESSAGE_BK_COLOR, 0);
  1349.     
  1350.      //show current focus
  1351.     osd_draw_region_rect(PASSWD_BUTTON_XSTART,PASSWD_BUTTON_YSTART,PASSWD_BUTTON_XLEN,PASSWD_BUTTON_YLEN,PASSWORD_BK_HL_COLOR,0);
  1352.     str = _OsdMessegeFont1[osd_font_mode][STR_OS_LOCK];
  1353.     osd_DrawRegionString(PASSWORD_XSTART, PASSWORD_YSTART, str, PASSWORD_FONT_COLOR, PASSWORD_BK_HL_COLOR, 0);
  1354.    
  1355. }
  1356. /*
  1357.  * check if the password is correct
  1358.  */
  1359. void show_NewParentalGui_page_OK(void)
  1360. {
  1361.         const char *str;
  1362.         
  1363.     
  1364.         osd_draw_region_rect(PASSWD_BUTTON_XSTART,PASSWD_BUTTON_YSTART,PASSWD_BUTTON_XLEN,PASSWD_BUTTON_YLEN,PASSWORD_BK_COLOR,0);
  1365.         //show UNLOCK state
  1366.         str = _OsdMessegeFont1[osd_font_mode][STR_OS_UNLOCK];
  1367.         osd_DrawRegionString(PASSWORD_XSTART, PASSWORD_YSTART, str , PASSWORD_FONT_COLOR, PASSWORD_BK_COLOR,0);       
  1368.         osd_draw_region_rect(OKERROR_BUTTON_XSTART,OKERROR_BUTTON_YSTART,OKERROR_BUTTON_XLEN,OKERROR_BUTTON_YLEN,OKERROR_BK_COLOR,0);    
  1369.         //show "OK"
  1370.         #ifdef PASSWORD_IN_CH
  1371.         
  1372.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART, _OsdMessegeFont1[osd_font_mode][STR_OS_PASSWORD_RIGHT] , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1373.         #else
  1374.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART,"OK" , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1375.         #endif
  1376.         delay_srv_10ms(200);//20040302
  1377. }
  1378. void show_NewParentalGui_page_ERROR(void)
  1379. {
  1380.         const char *str;
  1381.         osd_draw_region_rect(PASSWD_BUTTON_XSTART,PASSWD_BUTTON_YSTART,PASSWD_BUTTON_XLEN,PASSWD_BUTTON_YLEN,PASSWORD_BK_COLOR,0);
  1382.         //show UNLOCK state
  1383.         //show LOCK state
  1384.         str = _OsdMessegeFont1[osd_font_mode][STR_OS_LOCK]; 
  1385.         osd_DrawRegionString(PASSWORD_XSTART-2, PASSWORD_YSTART, str , PASSWORD_FONT_COLOR, PASSWORD_BK_COLOR,0);       
  1386.        // str = osd_err_str[osd_font_mode][PARENTAL_ERR-1];
  1387.         osd_draw_region_rect(OKERROR_BUTTON_XSTART,OKERROR_BUTTON_YSTART,OKERROR_BUTTON_XLEN,OKERROR_BUTTON_YLEN,OKERROR_BK_COLOR,0);
  1388.         #ifdef PASSWORD_IN_CH
  1389.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART, _OsdMessegeFont1[osd_font_mode][STR_OS_PASSWORD_ERROR]  , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);     //2004-2-20 09:24张宇M  
  1390.         #else
  1391.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART,"ERROR" , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1392.         #endif
  1393.         delay_srv_10ms(200);//20040302
  1394. }
  1395. void check_parent_password(void)
  1396. {
  1397.     extern const char *const osd_err_str[N_OSD_LANGS][3];
  1398.     const char *str;
  1399.     
  1400.     //if ((UserSet.parental_ststus == C_LOCK)&&    //hq marked, avoid entering play when double cliked ENTER Key without inputing password. 2004-3-5 13:28    
  1401. #ifdef SETUP_6_DIGIT_PASSWORD
  1402.     if ((UserSet.parental_ststus == C_LOCK)&&(digit_cnt == PASSWORD_LENGTH)&&
  1403. #else//SETUP_6_DIGIT_PASSWORD
  1404.     if ((UserSet.parental_ststus == C_LOCK)&&(digit_cnt == PASSWORD_LENGTH)&&
  1405. #endif//SETUP_6_DIGIT_PASSWORD
  1406. #ifdef USER_SUPER_PASSWD_ALSO_PLAY      //heqiang,2004-3-5 11:44
  1407.        ((tmp_passwd == UserSet.parent_passwd )||(tmp_passwd == USER_SUPER_PASSWORD )))
  1408. #else//USER_SUPER_PASSWD_ALSO_PLAY
  1409.        (tmp_passwd == UserSet.parent_passwd ))
  1410. #endif//USER_SUPER_PASSWD_ALSO_PLAY     
  1411.     {    
  1412.         UserSet.parental_ststus = C_UNLOCK;
  1413.         
  1414. /*
  1415.         osd_draw_region_rect(PASSWD_BUTTON_XSTART,PASSWD_BUTTON_YSTART,PASSWD_BUTTON_XLEN,PASSWD_BUTTON_YLEN,PASSWORD_BK_COLOR,0);
  1416.         //show UNLOCK state
  1417.         str = _OsdMessegeFont1[osd_font_mode][STR_OS_UNLOCK];
  1418.         osd_DrawRegionString(PASSWORD_XSTART, PASSWORD_YSTART, str , PASSWORD_FONT_COLOR, PASSWORD_BK_COLOR,0);       
  1419.         osd_draw_region_rect(OKERROR_BUTTON_XSTART,OKERROR_BUTTON_YSTART,OKERROR_BUTTON_XLEN,OKERROR_BUTTON_YLEN,OKERROR_BK_COLOR,0);    
  1420.         //show "OK"
  1421.         #ifdef PASSWORD_IN_CH
  1422.         
  1423.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART, _OsdMessegeFont1[osd_font_mode][STR_OS_PASSWORD_RIGHT] , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1424.         #else
  1425.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART,"OK" , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1426.         #endif
  1427.         delay_srv_10ms(200);//20040302
  1428. */
  1429.         show_NewParentalGui_page_OK();
  1430.     }
  1431.     else//if password id incorrect,show error message.
  1432.     {
  1433.         printf("uuuuuuu   show dvd errornn");
  1434.         //show grade error 
  1435.         //draw rect
  1436.         osd_draw_region_rect(PASSWD_BUTTON_XSTART,PASSWD_BUTTON_YSTART,PASSWD_BUTTON_XLEN,PASSWD_BUTTON_YLEN,PASSWORD_BK_COLOR,0);
  1437.         //show UNLOCK state
  1438.         //show LOCK state
  1439.         str = _OsdMessegeFont1[osd_font_mode][STR_OS_LOCK]; 
  1440.         osd_DrawRegionString(PASSWORD_XSTART-2, PASSWORD_YSTART, str , PASSWORD_FONT_COLOR, PASSWORD_BK_COLOR,0);       
  1441.        // str = osd_err_str[osd_font_mode][PARENTAL_ERR-1];
  1442.         osd_draw_region_rect(OKERROR_BUTTON_XSTART,OKERROR_BUTTON_YSTART,OKERROR_BUTTON_XLEN,OKERROR_BUTTON_YLEN,OKERROR_BK_COLOR,0);
  1443.         #ifdef PASSWORD_IN_CH
  1444.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART, _OsdMessegeFont1[osd_font_mode][STR_OS_PASSWORD_ERROR]  , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);     //2004-2-20 09:24张宇M  
  1445.         #else
  1446.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART,"ERROR" , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1447.         #endif
  1448.         delay_srv_10ms(200);//20040302
  1449.         
  1450.         show_NewParentalGui_page_ERROR();
  1451.     }
  1452.      reset_passwd_cnt();    //dingzhy 04-02-09 10:31AM
  1453. }
  1454. #else//#ifdef NEW_PARENTAL_GUI//zhaoyanhua add 2003-11-28 10:46
  1455. //function inital name is setup_Checkpassword()
  1456. //zhaoyanhua modify the function name 2003-11-29 20:34
  1457. #if  1//def SETUP_PASSWORD_GUI  //denghg  markede 2004-12-17 22:06
  1458. void ShowPasswordGUI()
  1459. {
  1460. #ifdef NEW_STYLE_SETUP    
  1461.     GBM_run_setupmenu_flag =1;
  1462. #endif
  1463. #ifdef MODIFY_PARENTAL_GUI
  1464.     parental_gui_flag = 1;
  1465. #endif//MODIFY_PARENTAL_GUI
  1466. #if defined(SDRAM_16Mb_Mode)//&&defined(NEW_STYLE_SETUP)
  1467.             //NOTE:
  1468.             //when SDRAM_16M_Mode,ShowTitle() may destroyed 
  1469.             // OSD memory. So must evaluate osd_base_addr again.
  1470.             //zhaoyanhua add 2003-11-10 17:06
  1471.             regs0->osd_base_addr=OSD_BASE_USE_ADDR;//P_BIDIR_LUMA;
  1472.             //clead 2004-3-26 add
  1473. #endif
  1474.     
  1475.     full_scrn=SETUP;
  1476.     osd_init_setup();
  1477.     UINT16 P=0;                 //denghg add  2004-12-17 22:04
  1478.   UINT16 I=0;
  1479.   UINT16 S=0;
  1480.     P=setup_getItemPos(STR_OS_PASSWORD);
  1481.   I=P&0xff;
  1482.     P=P>>8;
  1483.     for( S=0; S<MAX_ITEM_SEL; S++) {
  1484.            if (setup_item[P][I][S]==STR_OS_LOCK) break;
  1485.           }
  1486.    setup_sel[P][I]=S;
  1487.    setup_VA[SETUP_VA_PASSWORD]=setup_sel[P][I];
  1488.    setup_mLevel = SETUP_ML3;  
  1489.    setup_pos[SETUP_ML0] = setup_mLevel;
  1490.  setup_pos[SETUP_ML1] =P;
  1491.  setup_pos[SETUP_ML2] =I;
  1492.  setup_pos[SETUP_ML3] =S;
  1493.  setup_pos[SETUP_ML0] = setup_mLevel;
  1494.  setup_last_pos[0]=SETUP_ML2;   //denghg  add  end  2004-12-17 22:04
  1495.  ShowSetupPage(1);    
  1496.   /*  setupLevel=2;
  1497. #ifdef GBM_FULL_FUNCTION
  1498.     page = SysNextPage;
  1499. #else//GBM_FULL_FUNCTION    
  1500.     page = SYSPAGE;
  1501. #endif//GBM_FULL_FUNCTION   
  1502.     index_y=PASSWDITEM;
  1503.     index_y_start=0;
  1504.     index_y2=0;
  1505.     submenuStart=PASSWDITEM+2;
  1506.     ShowSetupPage(1);*/  //DENGHG MARKDE 20041216  22:30
  1507. }
  1508. #endif  //endif of SETUP_PASSWORD_GUI
  1509. #endif//#ifdef NEW_PARENTAL_GUI//zhaoyanhua add 2003-11-28 10:46
  1510. #if defined(DVD_AUDIO)//20040302
  1511. void check_dvd_audio_password(void)
  1512. {
  1513. //    extern const char *const osd_err_str[N_OSD_LANGS][3];
  1514. //    const char *str;
  1515.     
  1516.     printf("tmp_passwd=%dn",tmp_passwd);
  1517.     if (pDSV->HGR_INF==tmp_passwd)
  1518.     {            
  1519. //        osd_draw_region_rect(PASSWD_BUTTON_XSTART,PASSWD_BUTTON_YSTART,PASSWD_BUTTON_XLEN,PASSWD_BUTTON_YLEN,PASSWORD_BK_COLOR,0);
  1520.         //show UNLOCK state
  1521. //        str = _OsdMessegeFont1[osd_font_mode][STR_OS_UNLOCK];
  1522. //        osd_DrawRegionString(PASSWORD_XSTART, PASSWORD_YSTART, str , PASSWORD_FONT_COLOR, PASSWORD_BK_COLOR,0);       
  1523. /*
  1524.         osd_draw_region_rect(OKERROR_BUTTON_XSTART,OKERROR_BUTTON_YSTART,OKERROR_BUTTON_XLEN,OKERROR_BUTTON_YLEN,OKERROR_BK_COLOR,0);    
  1525.         //show "OK"
  1526.         #ifdef PASSWORD_IN_CH
  1527.         
  1528.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART, _OsdMessegeFont1[osd_font_mode][STR_OS_PASSWORD_RIGHT] , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1529.         #else
  1530.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART,"OK" , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1531.         #endif
  1532. */
  1533. #ifdef NEW_PARENTAL_GUI
  1534.         show_NewParentalGui_page_OK();
  1535. #endif        
  1536.        
  1537.         pDSV->hid_gp_chk_pwd=0;
  1538.         
  1539.     }
  1540.     else//if password id incorrect,show error message.
  1541.     {
  1542.         printf("uuuuuuu   show dvd errornn");
  1543.         //show grade error 
  1544.         //draw rect
  1545. //        osd_draw_region_rect(PASSWD_BUTTON_XSTART,PASSWD_BUTTON_YSTART,PASSWD_BUTTON_XLEN,PASSWD_BUTTON_YLEN,PASSWORD_BK_COLOR,0);
  1546.         //show UNLOCK state
  1547.         //show LOCK state
  1548. //        str = _OsdMessegeFont1[osd_font_mode][STR_OS_LOCK]; 
  1549. //        osd_DrawRegionString(PASSWORD_XSTART-2, PASSWORD_YSTART, str , PASSWORD_FONT_COLOR, PASSWORD_BK_COLOR,0);       
  1550. /*
  1551.        // str = osd_err_str[osd_font_mode][PARENTAL_ERR-1];
  1552.         osd_draw_region_rect(OKERROR_BUTTON_XSTART,OKERROR_BUTTON_YSTART,OKERROR_BUTTON_XLEN,OKERROR_BUTTON_YLEN,OKERROR_BK_COLOR,0);
  1553.         #ifdef PASSWORD_IN_CH
  1554.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART, _OsdMessegeFont1[osd_font_mode][STR_OS_PASSWORD_ERROR]  , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);     //2004-2-20 09:24张宇M  
  1555.         #else
  1556.         osd_DrawRegionString(OKERROR_XSTART-1, OKERROR_YSTART,"ERROR" , OKERROR_FONT_COLOR, OKERROR_BK_COLOR,0);  //2004-2-20 09:24张宇M     
  1557.         #endif
  1558. */
  1559. #ifdef NEW_PARENTAL_GUI
  1560.         show_NewParentalGui_page_ERROR();
  1561. #endif
  1562.     }
  1563.        delay_srv_10ms(200);
  1564. }
  1565. void ExitDVDAudioGUI(void)
  1566. {
  1567.     full_scrn = 0;
  1568. #ifdef NEW_PARENTAL_GUI
  1569.     new_parental_gui = 0;////avoid the error:when TRAY OUT enter SETUP ,show error infomation. 
  1570. #endif
  1571. #if defined(MODIFY_PARENTAL_GUI)
  1572.     parental_gui_flag = 0;
  1573. #endif//#if defined(MODIFY_PARENTAL_GUI)
  1574.                         //zhaoyanhua add 2004-2-9 11:24
  1575. #ifdef SDRAM_16Mb_Mode  //Maoyong 2004.07.03
  1576.     regs0->osd_base_addr=regs0->osdya;
  1577. #endif                        
  1578.     osd_init();
  1579. //    nav_param_by_user();
  1580. }
  1581. #endif//#if defined(DVD_AUDIO)//20040302
  1582. /*
  1583.  * Show password GUI and get input password
  1584.  * NOTE:
  1585.  *    these sentences are abstracted from ncmd_exe.
  1586.  *  
  1587.  * zhaoyanhua 2003-11-28 22:23
  1588.  */
  1589. void setup_CheckPasswd()
  1590. {
  1591.     extern int user_input_pwd;
  1592.    /* UserSet.parental_ststus=0;  //nono 2003-11-21 14:19*///denghg marked 2004-12-17 12:55
  1593.      UserSet.parental_ststus=C_LOCK;
  1594.     
  1595.     SetFullscrnCmdFuncPtr( setup_func_up, setup_func_down, setup_func_left,
  1596.                          setup_func_right,  setup_func_select);//denghg add 2004-12-16 20:57 
  1597. /*#ifdef SETUP_PASSWORD_GUI        
  1598.     ShowPasswordGUI();
  1599.  #endif*/  //denghg  markde 2004-12-16 20:46
  1600.      ShowPasswordGUI();//denghg add  2004-12-16 20:46
  1601.   
  1602.     user_input_pwd=1;               
  1603.     while(user_input_pwd==1)                
  1604.         polling();
  1605.             
  1606.     if(user_input_pwd==2)//nono 2-6-6 23:45 to avoid parental contrl invalid. 
  1607.     {
  1608.         //Maoyong 2004.03.06 , Record disc check Level in SYSTEM_SETUP_BROWSER,
  1609.         //I use (user_input_pwd ==2 ) to check specical exit PTL Level Check(IRC_POWER , IRC_EJECT)
  1610.         #ifdef  CHECK_RECORD_DISK_PARENT_LVL        
  1611.         if( (system_state == SYSTEM_BROWSE) )
  1612.         #endif
  1613.         user_input_pwd=0;
  1614.     }
  1615.     else
  1616. #ifdef NEW_PARENTAL_GUI//zhaoyanhua add 2003-11-28 19:50
  1617.         ExitParentalGUI();
  1618. #else
  1619.         ircmd_setup();
  1620. #endif
  1621. }
  1622. //#if defined(NEW_PARENTAL_GUI)&&defined(DVD_AUDIO)//20040302
  1623. #if defined(DVD_AUDIO)//20040302
  1624. void setup_CheckDVDAudioPasswd()
  1625. {
  1626.     extern int user_input_pwd;
  1627.     extern UINT8   polling_avoid_reentry;
  1628. #ifdef SETUP_PASSWORD_GUI    
  1629.     ShowPasswordGUI();
  1630. #endif    
  1631.  
  1632.     user_input_pwd=1;         
  1633.     polling_avoid_reentry=0;      
  1634.     while(user_input_pwd==1)                
  1635.         polling();
  1636.             
  1637.     if(user_input_pwd==2)//nono 2-6-6 23:45 to avoid parental contrl invalid. 
  1638.         user_input_pwd=0;
  1639.     else
  1640. #ifdef NEW_PARENTAL_GUI
  1641.         ExitDVDAudioGUI();
  1642. #else
  1643.         ircmd_setup();
  1644. #endif
  1645. }
  1646. #endif//#if defined(NEW_PARENTAL_GUI)&&defined(DVD_AUDIO)//20040302
  1647. void setup_SetKey()
  1648. {
  1649.     //SETUP_KEY = audio_key+8;
  1650.     //AudioSetKey(audio_key+8); //Key-shift command to DSP(1~15)
  1651.     setup_VA[SETUP_VA_KEY]=audio_key+MIN_ITEM_SEL+6;
  1652.     AUDIF_Set_Key(setup_VA[SETUP_VA_KEY]);//2004AUDDRV AudioSetKey(setup_VA[SETUP_VA_KEY]);
  1653. #ifndef NOT_REWRITE_MIC_VALUE //axel 2004/2/14 03:19PM
  1654.     //run_save_sel_cmd(AUDPAGE, KEYITEM);
  1655.     run_save_sel_cmd(setup_VA[SETUP_VA_KEY], SETUP_VA_KEY);
  1656. #endif  //NOT_REWRITE_MIC_VALUE //axel 2004/2/14 03:19PM
  1657. }
  1658. void setup_SetEcho()
  1659. {
  1660.     //SETUP_ECHO = echo_level+2;
  1661.     setup_VA[SETUP_VA_ECHO]=echo_level+MIN_ITEM_SEL;
  1662. #ifdef USE_MIC_ECHO_PARAM
  1663.     AUDIF_Set_EchoPara(echo_level);//2004AUDDRV AudioSetEchoPara(echo_level);
  1664. #else
  1665.     AUDIF_Set_Echo(echo_level, echo_level);//2004AUDDRV AudioSetEcho(echo_level, echo_level); //Echo command to DSP
  1666.  #ifndef NOT_REWRITE_MIC_VALUE     //axel 2004/2/8 10:05PM
  1667.         run_save_sel_cmd(setup_VA[SETUP_VA_ECHO], SETUP_VA_ECHO);
  1668.  #endif //NOT_REWRITE_MIC_VALUE //axel 2004/2/14 03:19PM
  1669. #endif //USE_MIC_ECHO_PARAM
  1670. }
  1671. void setup_SetMic()
  1672. {
  1673.     //#ifdef    MIC_2CHANNEL
  1674.     //if(id==STR_OS_MIC_VOL||id==STR_OS_MIC_VOL_1)
  1675.     //#endif
  1676. #if defined(MIC_2CHANNEL)&&defined(MIC_FUNCTION_KEY)
  1677.     if(bFuncStep==1)
  1678.     {
  1679.         //SETUP_MIC_VOL = mic_volume+2;
  1680.         setup_VA[SETUP_VA_MIC_VOL_1]=mic_volume+MIN_ITEM_SEL;
  1681.         AUDIF_Set_MICVol(mic_volume);//2004AUDDRV AudioSetMICVol(mic_volume);
  1682.             //#ifdef    MIC_2CHANNEL
  1683.     }
  1684.     else if(bFuncStep==5)
  1685.     {
  1686.             //SETUP_MIC_VOL_2 = mic_volume+2;
  1687.             setup_VA[SETUP_VA_MIC_VOL_2]=mic_volume+MIN_ITEM_SEL;
  1688.         AUDIF_Set_MICVol2(mic_volume);//2004AUDDRV AudioSetMICVol_2(mic_volume);
  1689.     }
  1690.     run_save_sel_cmd(setup_VA[SETUP_VA_MIC_VOL_1], SETUP_VA_MIC_VOL_1);
  1691.     run_save_sel_cmd(setup_VA[SETUP_VA_MIC_VOL_2], SETUP_VA_MIC_VOL_2);
  1692. #else// //#ifdef    MIC_2CHANNEL    
  1693.     setup_VA[SETUP_VA_MIC_VOL] = mic_volume+2;
  1694.     AUDIF_Set_MICVol(mic_volume);//2004AUDDRV AudioSetMICVol(mic_volume);  //fengjl edit it 2004-06-17 21:51
  1695. #ifndef NOT_REWRITE_MIC_VALUE   //axel 2004/2/14 03:19PM
  1696.     run_save_sel_cmd(setup_VA[SETUP_VA_MIC_VOL_1], SETUP_VA_MIC_VOL_1);
  1697. #endif //NOT_REWRITE_MIC_VALUE //axel 2004/2/14 03:19PM
  1698. #endif//    //#ifdef    MIC_2CHANNEL
  1699. }
  1700. int IsOSDChinese()
  1701. {
  1702.     UINT16 P, I;
  1703.     P=setup_getItemPos(STR_OS_OSD);
  1704.     I=P&0xff;
  1705.     P=P>>8;
  1706.     
  1707.     //if (setup_item[LANGPAGE][LANGITEM][osd_font_mode+2]==LCD_ZH)  return 1;
  1708.     if (setup_item[P][I][osd_font_mode+2]==LCD_ZH)  return 1;
  1709.     else    return 0;
  1710. }
  1711. #ifdef DOUBLE_LOGO  //terry,2004/2/10 04:18PM
  1712. //xiaosan 2-7-19 13:36
  1713. //input :void
  1714. //ouput :1->en,0->zh
  1715. int OsdIsEnglish(void)
  1716. {
  1717.     UINT16 P, I;
  1718.     P=setup_getItemPos(STR_OS_OSD);
  1719.     I=P&0xff;
  1720.     P=P>>8;
  1721.     //if(setup_item[LANGPAGE][LANGITEM][osd_font_mode+2]==LCD_EN)
  1722.     if(setup_item[P][I][osd_font_mode+2]==LCD_EN)
  1723.         return 1;
  1724.     else
  1725.         return 0;
  1726. }
  1727. #endif
  1728. //20041222 JSLin // this function should always exist
  1729. void setup_SetFreqMaskConfig()
  1730. {
  1731.     UINT16 P, I, S;
  1732.     P=setup_getItemPos(STR_OS_FREQ_MASK);
  1733.     I=P&0xff;
  1734.     P=P>>8;
  1735.     
  1736.     if(P==0xff) // STR_OS_FREQ_MASK doesn't exist in setup_item[][][]
  1737.     {
  1738.         AUDIF_Set_FrqMsk(FREQ_MASK_DEFAULT);
  1739.     }
  1740.     else
  1741.     {
  1742.         S = setup_sel[P][I];
  1743.         switch(setup_item[P][I][S]) 
  1744.         {
  1745.             case STR_OS_48K:
  1746.                 AUDIF_Set_FrqMsk(0);
  1747.                 break;
  1748.             case STR_OS_96K:
  1749.                 AUDIF_Set_FrqMsk(1);
  1750.                 break;
  1751.             case STR_OS_192K:
  1752.                 AUDIF_Set_FrqMsk(2);
  1753.                 break;
  1754.             default:
  1755.                 AUDIF_Set_FrqMsk(FREQ_MASK_DEFAULT);        
  1756.                 break;
  1757.         }
  1758. /*    
  1759.         #ifdef SPHE1000
  1760.             exe_setup_function(STR_OS_FREQ_MASK,setup_item[P][I][setup_VA[SETUP_VA_FREQ_MASK]],0);   
  1761.         #else
  1762.             exe_setup_function(STR_OS_FREQ_MASK,setup_item[P][I][setup_VA[SETUP_VA_FREQ_MASK]],0);   
  1763.         #endif
  1764. */        
  1765.     }
  1766. }
  1767. //not sure about this function  ==> try to set STR_OS_DTS_DIGITAL??
  1768. void setup_SetDTSCDConfig()
  1769. {
  1770.     UINT16 P, I;
  1771.     P=setup_getItemPos(STR_OS_AUD_OUT);
  1772.     I=P&0xff;
  1773.     P=P>>8;
  1774.     exe_setup_function(STR_OS_AUD_OUT, setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]], 0);
  1775.     //printf("nnsetup_SetDTSCDConfig in1n");
  1776.     //exe_setup_function(setup_item[AUDPAGE][DIGIOUTITEM][1],setup_item[AUDPAGE][DIGIOUTITEM][ SETUP_SPDIF ],0);
  1777.     //setup_SetDTSConfig();//terry,2004/2/10 03:51PM
  1778.     //printf("nnsetup_SetDTSCDConfig outn");
  1779. }
  1780. //not sure about this function  ==> try to set spdif??
  1781. void setup_SetSPDIFConfig()//2003-8-15 20:56 for avoid SPDIF noise when power on.
  1782. {
  1783.     UINT16 P, I;
  1784.     P=setup_getItemPos(STR_OS_AUD_OUT);
  1785.     I=P&0xff;
  1786.     P=P>>8;
  1787.     exe_setup_function(STR_OS_AUD_OUT, setup_item[P][I][setup_VA[SETUP_VA_AUD_OUT]], 0);
  1788.     //exe_setup_function(setup_item[AUDPAGE][DIGIOUTITEM][1],setup_item[AUDPAGE][DIGIOUTITEM][ SETUP_SPDIF ],0);
  1789. }
  1790. void setup_SetDTSDOWNMIXConfig()//NONO force set downmix 2003-11-24 14:23
  1791. {
  1792. // 3 -12-9 19:04 NONO MARKED.uopdate dsp code.
  1793.     if( (cd_type_loaded ==CDDA)&&(cd_subtype==CD_DTS) )
  1794.     {
  1795.         UINT16 P, I;
  1796.         P=setup_getItemPos(STR_OS_DOWNMIX_SETUP);
  1797.         I=P&0xff;
  1798.         P=P>>8;
  1799.             exe_setup_function(STR_OS_DOWNMIX_SETUP, setup_item[P][I][setup_VA[SETUP_VA_DOWNMIX]],0);
  1800.     }
  1801. }
  1802. //check whether MIC is OFF, Jeff 20020524
  1803. int setup_IsMICOff()
  1804. {
  1805.     UINT16 P, I;
  1806.     P=setup_getItemPos(STR_OS_MIC_ONOFF);
  1807.     I=P&0xff;   
  1808.     P=P>>8;
  1809.     if (setup_item[P][I][setup_VA[SETUP_VA_MIC_ONOFF]]==STR_OS_OFF)//( (SETUP_MIC_ONF-1)==MICOFF) 
  1810.         return 1;
  1811.     else 
  1812.         return 0;
  1813. }
  1814. //Set MIC to Auto mode
  1815. void setup_SetMICAuto()
  1816. {
  1817.     UINT32 P, I, S;
  1818.     P=setup_getItemPos(STR_OS_MIC_ONOFF);
  1819.     I=P&0xff;
  1820.     P=P>>8;
  1821.     for(S=MIN_ITEM_SEL; S<MAX_ITEM_SEL; S++){
  1822.         if(setup_item[P][I][S]==STR_OS_AUTO)
  1823.             break;
  1824.     }
  1825.     setup_VA[SETUP_VA_MIC_ONOFF]=S;
  1826.     
  1827.     // 1st parameter was set to 0(OFF) originally, this seems like a bug
  1828.     AUDIF_Set_MICStatus(STATUS_AUTO, 0);//2004AUDDRV AudioSetMIC(0, 0); //Set MIC auto detect, 2:auto, (the second parameter:unsed now)
  1829.     run_save_sel_cmd(setup_VA[SETUP_VA_MIC_ONOFF], SETUP_VA_MIC_ONOFF);    //gerry,3-10-20 17:10
  1830. }
  1831. void setup_SetMICOff()//nono 20020707
  1832. {
  1833.     UINT32 P, I, S;
  1834.     P=setup_getItemPos(STR_OS_MIC_ONOFF);
  1835.     I=P&0xff;
  1836.     P=P>>8;
  1837.     for(S=MIN_ITEM_SEL; S<MAX_ITEM_SEL; S++){
  1838.         if(setup_item[P][I][S]==STR_OS_OFF)
  1839.             break;
  1840.     }
  1841.     setup_VA[SETUP_VA_MIC_ONOFF]=S;
  1842.     
  1843.     AUDIF_Set_MICStatus(STATUS_OFF, 0);//2004AUDDRV AudioSetMIC(0, 0); //Set MIC Off(the second parameter:unsed now)
  1844.     run_save_sel_cmd(setup_VA[SETUP_VA_MIC_ONOFF], SETUP_VA_MIC_ONOFF);    //gerry,3-10-20 17:10
  1845. }
  1846. //wanghaoying 2003-9-15 15:15
  1847. //*****    0: mic auto
  1848. //*****    1: mic off
  1849. #ifdef DEFAULT_MIC_OFF
  1850. BYTE mic_flag=1;
  1851. #else
  1852. BYTE mic_flag=0;
  1853. #endif
  1854. void setup_MIC(BYTE set)//nono 20020707
  1855. {
  1856. #ifndef NO_MIC //Jack added 04/07/03
  1857.     int id;
  1858.     //BYTE font[]={STR_OS_ON,STR_OS_OFF};
  1859.     if(setup_IsMICOff())
  1860.         id= STR_OS_OFF; //mic_flag=1;
  1861.     else
  1862.         id= STR_OS_ON;
  1863.     if (set) {
  1864.         if(mic_flag==1)
  1865.         {
  1866.             id= STR_OS_ON;
  1867.             mic_flag=0;
  1868.             setup_SetMICAuto();
  1869.         }
  1870.         else
  1871.         {
  1872.             id= STR_OS_OFF;
  1873.             mic_flag=1;
  1874.             setup_SetMICOff();
  1875.         }
  1876.     }
  1877.     //id = font[mic_flag];
  1878.     //PrintOsdMsg(STR_OS_MIC_ONOFF|(id<<8),REGION1,1,4);
  1879.     PrintOsdMsg(STR_OS_MIC_ONOFF|(id<<OSDSTR_ID_TOTL_BIT),REGION1,1,4);
  1880. #endif
  1881. }
  1882. /*
  1883. **wanghaoying 2003-9-11 14:12
  1884. **return value: 2--->DOWNMIXLTRT
  1885. **              3--->DOWNMIXSTEREO
  1886. **              4--->DOWNMIXVSRND
  1887. **              5--->AC3DOWNMIXOFF
  1888. */
  1889. UINT8 setup_GetDownmixMode(void)
  1890. {
  1891.     return (setup_VA[SETUP_VA_DOWNMIX]);//(SETUP_SPK_DOWNMIX);
  1892. }
  1893. #ifdef SUPPORT_PROLOGIC_II  //axel 2004/1/26 11:45
  1894. /*
  1895. **wanghaoying 2003-9-18 11:29
  1896. **return value:
  1897. **
  1898. **
  1899. */
  1900. UINT8 setup_GetPrologicII(void)
  1901. {
  1902.     return (setup_VA[SETUP_VA_PROLOGIC]);//(SETUP_PROLOGIC_II);
  1903. }
  1904. #endif
  1905. #ifdef MIC_2CHANNEL//NONO 4-1-5 12:10//FOR MUTE_EXECUTE_MIC
  1906. UINT8 setup_GetMICVol(void)
  1907. {
  1908.     return (setup_VA[SETUP_VA_MIC_VOL_1]);
  1909. }
  1910. UINT8 setup_GetMICVol2(void)
  1911. {
  1912.     return (setup_VA[SETUP_VA_MIC_VOL_2]);
  1913. }
  1914. #endif//MIC_2CHANNEL
  1915. //gerry add for gbm,when we set to S-VIDEO,tv dac3 will be off,2004-5-13 15:44
  1916. #if defined(S_VIDEO_OUT)&&defined(S_VIDEO_SET_TV_DAC3_OFF)
  1917. /*
  1918. ** gerry,2004-5-19 15:36
  1919. **return value: 2--->S_VIDEO
  1920. */
  1921. UINT8 setup_GetVideoMode(void)
  1922. {
  1923.     return (setup_VA[SETUP_VA_VIDEO]);//(SETUP_VIDEO_FORMAT);
  1924. }
  1925. #endif
  1926. /*
  1927. void SetSharpness(BYTE nVal)
  1928. {
  1929.     printf("....SetSharpness = %dn", nVal);
  1930. }
  1931. */
  1932. // video adjustment default setting ,seanlin 2004/08/17
  1933. //#define CUSTOMER_ADJ_CURVE
  1934. //#define EXTEND_CURVE_SCALE
  1935. #define DEFAULT_CURVE1   16
  1936. #define DEFAULT_CURVE2   224
  1937. #ifdef  CUSTOMER_ADJ_CURVE
  1938.     #define ADJ_SATURATION   2
  1939.     #define ADJ_CURVE1      16
  1940.     #define ADJ_CURVE2      224
  1941. #else
  1942.     #define ADJ_SATURATION   0
  1943.     #define ADJ_CURVE1      16
  1944.     #define ADJ_CURVE2      224
  1945. #endif
  1946. #ifdef EXTEND_CURVE_SCALE
  1947.     #define CURVE_SCALE 10
  1948. #else
  1949.     #define CURVE_SCALE 5
  1950. #endif
  1951. void SetBrightness(BYTE nVal)
  1952. {
  1953.     int Src1, Src2, Dest1, Dest2;
  1954.     //Src1  = DEFAULT_CURVE1 + (SETUP_CONTRAST - 8) * 5;
  1955.     Src1  = DEFAULT_CURVE1 + (setup_VA[SETUP_VA_CONTRAST] - 8) * CURVE_SCALE;
  1956.     Dest1 = ADJ_CURVE1 + (nVal - 6) * CURVE_SCALE;
  1957.     if(Dest1<0) Dest1 =0;
  1958.     if(Src1<0) Src1 =0;
  1959.     //Src2  = DEFAULT_CURVE2 - (SETUP_CONTRAST - 8) * 5;
  1960.     Src2  = DEFAULT_CURVE2 - (setup_VA[SETUP_VA_CONTRAST] - 8) * CURVE_SCALE;
  1961.     Dest2 = ADJ_CURVE2 + (nVal - 6) * CURVE_SCALE;
  1962.     setup_vpp_curve (Src1,Dest1,Src2,Dest2);
  1963. }
  1964. void SetContrast(BYTE nVal)
  1965. {
  1966.     int Src1, Src2, Dest1, Dest2;
  1967.     
  1968.     //joshua, 2005.1.3, increasing values of contrast and saturation in JPEG all-screen mode.
  1969.     if(Is_JPEG_PLAY_STATE())
  1970.     {
  1971.         nVal += 2;
  1972.         
  1973.         if(nVal>12)  
  1974.             nVal = 12;        
  1975.     }
  1976.     Src1 = DEFAULT_CURVE1 + (nVal - 6) * CURVE_SCALE;
  1977.     //Dest1 = ADJ_CURVE1 + (SETUP_BRIGHTNESS - 8) * 5;
  1978.     Dest1 = ADJ_CURVE1 + (setup_VA[SETUP_VA_BRIGHTNESS] - 8) * CURVE_SCALE;
  1979.     if(Dest1<0) Dest1 =0;
  1980.     if(Src1<0) Src1 =0;
  1981.     Src2 = DEFAULT_CURVE2 - (nVal - 6) * CURVE_SCALE;
  1982.     //Dest2 = ADJ_CURVE2 + (SETUP_BRIGHTNESS - 8) * 5;
  1983.     Dest2 = ADJ_CURVE2 + (setup_VA[SETUP_VA_BRIGHTNESS] - 8) * CURVE_SCALE;
  1984.     setup_vpp_curve (Src1,Dest1,Src2,Dest2);
  1985.     setup_tv_luma_scaling(nVal);
  1986. }
  1987. #ifdef IR_KEY_SET_VIDEO_MODE
  1988. void SetBrightnessAdjust(BYTE nVal, BYTE nVal2)
  1989. {
  1990.     int Src1, Src2, Dest1, Dest2;
  1991.     Src1 = DEFAULT_CURVE1 + (nVal2 - 8) * CURVE_SCALE;
  1992.     Dest1 = ADJ_CURVE1 + (nVal - 6) * CURVE_SCALE;
  1993.     if(Dest1<0) Dest1 =0;
  1994.     if(Src1<0) Src1 =0;
  1995.     Src2 = DEFAULT_CURVE2 - (nVal2 - 8) * CURVE_SCALE;
  1996.     Dest2 = ADJ_CURVE2 + (nVal - 6) * CURVE_SCALE;
  1997.     setup_vpp_curve (Src1,Dest1,Src2,Dest2);
  1998. }
  1999. void SetContrastAdjust(BYTE nVal, BYTE nVal2)
  2000. {
  2001.     int Src1, Src2, Dest1, Dest2;
  2002.     Src1 = DEFAULT_CURVE1 + (nVal - 6) * CURVE_SCALE;
  2003.     Dest1 = ADJ_CURVE1 + (nVal2 - 8) * CURVE_SCALE;
  2004.     if(Dest1<0) Dest1 =0;
  2005.     if(Src1<0) Src1 =0;
  2006.     Src2 = DEFAULT_CURVE2 - (nVal - 6) * CURVE_SCALE;
  2007.     Dest2 = ADJ_CURVE2 + (nVal2 - 8) * CURVE_SCALE;
  2008.     setup_vpp_curve (Src1,Dest1,Src2,Dest2);
  2009. }
  2010. #endif//IR_KEY_SET_VIDEO_MODE
  2011. #include <math.h>
  2012. // the accepted range are from 0 to 100
  2013. void SetHUE(BYTE nVal)
  2014. {
  2015.     static const UINT8 lookup_table[][4] = {
  2016.         //bb br rb rr
  2017.         {1, 6,  0,  0}, // 0
  2018.         {0, 5,  0,  0}, // 1
  2019.         {0, 4,  0,  0}, // 2
  2020.         {0, 3,  0,  0}, // 3
  2021.         {0, 2,  0,  0}, // 4
  2022.         {0, 1,  0,  0}, // 5
  2023.         {0, 0,  0,  0}, // 6
  2024.         {0, 0,  1,  0}, // 7
  2025.         {0, 0,  2,  0}, // 8
  2026.         {0, 0,  3,  0}, // 9
  2027.         {0, 0,  4,  0}, // 10
  2028.         {0, 0,  5,  0}, // 11
  2029.         {0, 0,  6,  1}, // 12
  2030.     };
  2031.     if (nVal>12) nVal=6;
  2032.     setup_osd_hue (
  2033.         lookup_table[nVal][0],  // bb
  2034.         lookup_table[nVal][1],  // br
  2035.         lookup_table[nVal][3],  // rr
  2036.         lookup_table[nVal][2]   // rb
  2037.     );
  2038.     //printf("....SetHUE = %dn", nVal);
  2039. }
  2040. void SetSaturation(BYTE nVal)
  2041. {    
  2042.     //joshua, 2005.1.3, increasing values of contrast and saturation in JPEG all-screen mode.
  2043.     if(Is_JPEG_PLAY_STATE())
  2044.     {
  2045.         nVal += 6;
  2046.         
  2047.         if(nVal>12)  
  2048.             nVal = 12;        
  2049.     }
  2050.       
  2051.     // the input value is from (0,0,0) to (7,7,0)
  2052.     // here uses (0,0,0), (1,1,0), (2,2,0), (3,3,0), (4,4,0), (5,5,0), (6,6,0),
  2053.     // (7,2,0), (7,3,0), (7,4,0), (7,5,0), (7,6,0), (7,7,0),
  2054.     nVal += ADJ_SATURATION ;
  2055.      
  2056.     setup_osd_chroma(nVal, 0, 0);
  2057.     //printf("....SetSaturation = %dn", nVal);
  2058. }
  2059. #ifdef DIP_CFG_ENABLE
  2060. void SetDeInterlace(BYTE nVal)
  2061. {
  2062.     if(nVal <= 6)
  2063.         dip_sel = nVal;
  2064.     if( (dip_sel == 0)||(cd_type_loaded!=CDDVD) )
  2065.         dip_enable = 0;
  2066.     else
  2067.         dip_enable = 1;
  2068.     //printf("....dip_sel = %dn", dip_sel);
  2069.     //printf("....dip_enable = %dn", dip_enable);
  2070. }
  2071. #endif //#ifdef DIP_CFG_ENABLE
  2072. #ifndef DVD_3D_SHOW_SPECTRUM  //terry,2004/2/10 04:58PM
  2073. void setup_DVD3DSound(BYTE set)
  2074. {
  2075.     //BYTE newsel, newid;
  2076.     //newsel = SETUP_SPK_DOWNMIX;
  2077.     //newid = ITEM_SPK_DOWNMIX[newsel]; //Jeff 20020604
  2078.     UINT16 P, I, S;
  2079.     P=setup_getItemPos(STR_OS_DOWNMIX_SETUP);
  2080.     I=P&0xff;
  2081.     P=P>>8;
  2082.     S=setup_VA[SETUP_VA_DOWNMIX];
  2083.     if (set) {
  2084.         AUDIF_Set_Pause();//2004AUDDRV AudioSetPause(); //Jeff 20020605
  2085.         //delay_1ms(100);
  2086. #ifdef NEW_SEARCH_OSD
  2087.         if(key_up_down == 1)
  2088.         {
  2089.             S++;
  2090.         }
  2091.         else if(key_up_down == 0)
  2092.         {
  2093.             S--;
  2094.         }
  2095. #else
  2096.         S++;
  2097. #endif
  2098. /*  marded by JS 20040822       //don't understand what this is!
  2099. #ifdef NEW_SEARCH_OSD
  2100.         if (newsel > AC3DOWNMIXOFF) newsel=SPKSTART;
  2101.         if (newsel < SPKSTART) newsel=AC3DOWNMIXOFF;
  2102. #elif defined(VTREK_DVD)        //wanghaoying 2003-9-20 18:55
  2103.         if (newsel < DOWNMIXSTEREO) 
  2104.             newsel = DOWNMIXSTEREO;
  2105.         else if ((newsel > DOWNMIXSTEREO)&&(newsel < AC3DOWNMIXOFF)) 
  2106.             newsel = AC3DOWNMIXOFF;
  2107.         else if (newsel > AC3DOWNMIXOFF) 
  2108.             newsel = DOWNMIXSTEREO;
  2109. #else
  2110.         if (newsel > AC3DOWNMIXOFF) newsel=2;
  2111. #endif
  2112. */
  2113.     if(setup_item[P][I][S]==0) {S=MIN_ITEM_SEL;}
  2114.             
  2115.         setup_VA[SETUP_VA_DOWNMIX] = S;
  2116.         //newid = ITEM_SPK_DOWNMIX[newsel]; //Jeff 20020604
  2117.         //to run speaker setup downmix mode
  2118.         exe_setup_function( STR_OS_DOWNMIX_SETUP, setup_item[P][I][S], 0);
  2119.         AUDIF_Set_Play();//2004AUDDRV AudioSetPlay(); //Jeff 20020605
  2120. #ifdef NEW_SEARCH_OSD
  2121.         sound_type = setup_item[P][I][S];//newid;
  2122. #endif
  2123.     }
  2124.     //PrintOsdMsg(STR_OS_SURR|(newid<<8),REGION1,1,4);
  2125.     PrintOsdMsg(STR_OS_SURR|(setup_item[P][I][S]<<OSDSTR_ID_TOTL_BIT),REGION1,1,4);
  2126. }
  2127. #endif
  2128. #endif
  2129. #ifdef USE_IR_TO_CHANGE_TVTYPE
  2130. void setup_DVD_TVType(BYTE set) //STR_OS_TV_RATIO
  2131. {
  2132.         UINT32 P, I, S;
  2133.         S = setup_VA[SETUP_VA_TV_RATIO];
  2134.     
  2135.         if (set) {
  2136.             S++;
  2137.         if (S > 4) {S=2;}
  2138.             setup_VA[SETUP_VA_TV_RATIO]=S;
  2139.         P=setup_getItemPos(STR_OS_TV_RATIO);
  2140.         I=P&0xff;
  2141.         P=P>>8;
  2142.         exe_setup_function( setup_item[P][I][1], setup_item[P][I][S], 0);
  2143.             ExitSetupPage(1);   //nono 20031213
  2144.             if( 0 )//NP_P_CFG_for_Video != UserSet.P_V_CFG)
  2145.             {
  2146.                 if(cd_type_loaded==CDDVD)
  2147.                 {        
  2148.                         osd_disable();
  2149.                         set_video_aspect();
  2150.                         if( is_aspect_menu()== 0x02 )
  2151.                         {
  2152.                             osd_init();
  2153.                             delay_srv_10ms(10);
  2154.                             rep_run_the_menu();
  2155.                         }
  2156.                 }
  2157.         }
  2158.     }
  2159.         
  2160.     //PrintOsdMsg(STR_OS_SURR|(newid<<8),REGION1,1,4);
  2161.     PrintOsdMsg(STR_OS_TV_RATIO|(setup_item[P][I][S]<<OSDSTR_ID_TOTL_BIT),REGION1,1,4);
  2162.     
  2163.     run_save_sel_cmd(SYSPAGE,2);
  2164. }
  2165. #endif//USE_IR_TO_CHANGE_TVTYPE
  2166. #ifdef AUTO_PLAY
  2167. BYTE auto_play_on()
  2168. {
  2169.     BYTE res;
  2170.     res = setup_VA[SETUP_VA_SSAVER]; //SETUP_SSAVER;
  2171.     
  2172.     if (res < 2) res=2;
  2173.     if (res==2) {
  2174.         res = 1;
  2175.     } else {
  2176.         res = 0;
  2177.     }
  2178.     return res;
  2179. }
  2180. #endif
  2181. #ifdef  VGA_CTRL_FORMAT
  2182. int setup_IsVGAOn() //wangfeng,2003-10-23 13:15
  2183. {
  2184.     int iRes=0;
  2185.     if ((id==STR_OS_TV_SYS)&&(tv_out_id==PC_VGA)) iRes=1;
  2186.     return iRes;
  2187. }
  2188. #endif
  2189. #ifdef  KARAOKE_MENU
  2190. //JS 20040820   //this function should be modified to show KARAOKE page by new method
  2191. void setup_KARAOKE()
  2192. {
  2193. #ifdef NEW_STYLE_SETUP    
  2194.     GBM_run_setupmenu_flag =1;
  2195. #endif
  2196.     if(KARAOKE_MENU_FLAG)
  2197.     KARAOKE_MENU_FLAG=0;
  2198.     
  2199.     else{
  2200.     full_scrn=SETUP;
  2201.     KARAOKE_MENU_FLAG=1;
  2202.     osd_init_setup();
  2203.     setupLevel=1;//2;
  2204.     page = AUDPAGE;
  2205.     index_y=MICONOFFITEM;//PASSWDITEM;
  2206.     index_y_start=0;
  2207.     index_y2=0;
  2208.     submenuStart=MICONOFFITEM+2;//PASSWDITEM+2;
  2209.     
  2210.     ShowSetupPage(2);
  2211.     
  2212.     }
  2213. }
  2214. #endif
  2215. #ifdef  SUPPORT_PROLOGIC_II
  2216. int setup_IsPrologicOn()    //wangfeng,2003-10-23 13:15
  2217. {
  2218.     int iRes=0;
  2219.     UINT16 P, I;
  2220.     P=setup_getItemPos(STR_OS_PROLOGIC);
  2221.     I=P&0xff;
  2222.     P=P>>8;
  2223.     if (setup_item[P][I][setup_VA[SETUP_VA_PROLOGIC]]!=STR_OS_OFF) 
  2224.       {iRes=1;}
  2225.     return iRes;
  2226. }
  2227. /*
  2228.  * turn OFF PROLOGIC II
  2229.  * zhaoyanhua 2004-2-11 13:48
  2230.  */
  2231.  void setup_OffPrologic_II(void)
  2232.  {
  2233. //#define PROLOGIC_OFF 4
  2234.         //printf("#### hehehehehehehhehehhe-----PRGLOCOG ---n");
  2235.         exe_setup_function(STR_OS_PROLOGIC,STR_OS_OFF,0);
  2236.     UINT16 P,I, S;
  2237.     P=setup_getItemPos(STR_OS_PROLOGIC);
  2238.     I=P&0xff;
  2239.     P=P>>8;
  2240.     for (S=MIN_ITEM_SEL; S<MAX_ITEM_SEL; S++){
  2241.         if(setup_item[P][I][S]==STR_OS_OFF)
  2242.             {break;}
  2243.     }
  2244.     
  2245.         setup_VA[SETUP_VA_PROLOGIC]=S;
  2246.     run_save_sel_cmd(setup_VA[SETUP_VA_PROLOGIC], SETUP_VA_PROLOGIC);
  2247.  }
  2248. #endif
  2249. //Maoyong 2004.05.19 for record password input state, used in ir_parser.c now
  2250. BYTE setup_IsSettingPassword(void)
  2251. {
  2252.     printf("nn    <<<<setup_IsSettingPassword>>>n");
  2253.     if( (full_scrn & SETUP) && (setup_item[page][index_y][1] == STR_OS_PASSWORD) )
  2254.         return 1;
  2255.     else
  2256.         return 0;
  2257. }
  2258. #ifdef SHOW_STANDBY_TIMER     //suqiaoli add 2003-8-2
  2259. //JS 20040820   //this function should be modified to show standby  timer in new method 
  2260. void polling_setup_standby_timer(void)
  2261. {
  2262.     if((setup_item[page][index_y][1]==STR_OS_VFD_TIME)&&(setupLevel==1))    
  2263.     {
  2264.         psprintf(linebuf, "%02d:%02d:%02d",show_standby_hour, show_standby_min, show_standby_sec);
  2265.         osd_DrawString(SETUP_SUB_XSTART+1,STANDBY_TIMER_ITEM+index_y, linebuf, SDEFAULTCOLOR,SBGCOLOR);
  2266.     }
  2267.     if (setup_item[page][index_y][1]==STR_OS_VFD_TIME)
  2268.         flag_standby_timer=1;
  2269.     else
  2270.         flag_standby_timer=0;
  2271. }
  2272. #endif
  2273. #ifdef CORTROL_VCD_ONF
  2274. int setup_IsVCD_OFF() //wangap add 2005/5/27
  2275. {
  2276.     UINT16 P,I;
  2277.     P=setup_getItemPos(STR_OS_VCD);
  2278.     I=P&0xff;
  2279.     P=P>>8;
  2280.     if ( setup_item[P][I][setup_VA[SETUP_VA_VCD]]==STR_OS_OFF) return 1;
  2281.         else return 0;
  2282. }
  2283. #endif
  2284. #ifdef SUPPORT_SPI_QSI
  2285. //for spi cmd to setup ssaver uOnOff = 0: on, 1: off
  2286. void setup_SPI_ssaver_onoff(UINT32 uOnOff)
  2287. {
  2288.     setup_VA[SETUP_VA_SSAVER] = MIN_ITEM_SEL + uOnOff;
  2289.     //run_save_sel_cmd(setup_VA[SETUP_VA_SSAVER],SETUP_VA_SSAVER);
  2290. }
  2291. void custm_SPI_region_setting(UINT32 uRegion)
  2292. {
  2293.     UINT8 uID;
  2294.     UINT16 P, I;
  2295.     UserSet.P_RCD = uRegion;
  2296.     //printf("-=-=-=-=-=--=-=-reg=%d UID=%dn",uRegion,UserSet.P_RCD);
  2297.     setup_VA[SETUP_VA_REGION_CODE] = uRegion + 2; //setup item update
  2298.     run_save_total_userSet();   //save user set update
  2299.     P=setup_getItemPos(STR_OS_REGION_CODE);
  2300.     I=P&0xff;
  2301.     P=P>>8;
  2302.     uID = setup_item[P][I][setup_VA[SETUP_VA_REGION_CODE]];
  2303.     //PrintOsdMsg(uID, REGION1, 1, 0);
  2304. }
  2305. #endif
  2306. #ifdef  TEST_BASS_MANAGEMENT
  2307. UINT16 SetBassConfig()    
  2308. {
  2309.     UINT16 bass_config;
  2310.     int front,center,surround,sub;
  2311.     
  2312.     front = setup_VA[SETUP_VA_FSPK]-MIN_ITEM_SEL;//SETUP_SPK_FRONT-2;
  2313.     center = setup_VA[SETUP_VA_CSPK]-MIN_ITEM_SEL;//SETUP_SPK_CENTER-2;
  2314.     surround = setup_VA[SETUP_VA_SSPK]-MIN_ITEM_SEL;//SETUP_SPK_SURROUND-2;
  2315.     sub = setup_VA[SETUP_VA_SUBWOOFER]-MIN_ITEM_SEL;//SETUP_SPK_SUBWOOFER-2;
  2316.     bass_config = 0;
  2317.     
  2318.     printf("test : front=%d,center=%d,surround=%d,sub=%dn",front,center,surround,sub);
  2319.     
  2320.     //mapping table
  2321.     switch (front)
  2322.     {
  2323.         case 0:  //Front Large
  2324.             if (surround==0) //Surround Large
  2325.             {
  2326.                 if ((sub==0)||((sub==1)&&(center==1)))
  2327.                     bass_config = 3; //config3
  2328.                 else
  2329.                     bass_config = 0; //x
  2330.             }
  2331.             else if(surround==2) //Surround None
  2332.             {
  2333.                 if (center==1) //Center Small
  2334.                     bass_config = 2; //simplified
  2335.                 else //Center Large or None 
  2336.                     bass_config = 0; //x
  2337.             }
  2338.             else    //Surround Small
  2339.             {
  2340.                 bass_config = 2; //simplified
  2341.             }                
  2342.             break;
  2343.         case 1:  //Front Small
  2344.             if (surround==0) //Surround Large
  2345.                 bass_config = 4; //car-simplified
  2346.             else 
  2347.                 bass_config = 1; //config1;
  2348.             break;                 
  2349.     }
  2350.     bass_config = 0x00ffff & ((front<<12)+(center<<8)+(surround<<4)+bass_config);
  2351.     printf ("test : return bass_config = %x,%dn",bass_config,bass_config);
  2352.     return bass_config;
  2353. }
  2354. #endif  //TEST_BASS_MANAGEMENT
  2355. #ifdef SELECT_MEDIA_IN_SETUPMENU    //Maoyong 2004-8-9 18:12
  2356. void setupSettingMediaItem(void)
  2357. {
  2358.     //we shouldn't use the define of DISC_ITEM, USB_ITEM, and CARD_ITEM
  2359.     UINT16 P, I;
  2360.     P=setup_getItemPos(STR_OS_MEDIA_TYPE);
  2361.     I=P&0xff;
  2362.     P=P>>8;
  2363.     
  2364.     if(media_type == MEDIA_CD){
  2365.     //SETUP_MEDIA_TYPE = DISC_ITEM + 2;
  2366.     setup_sel[P][I] = DISC_ITEM + MIN_ITEM_SEL;
  2367.     setup_VA[SETUP_VA_MEDIA_TYPE] = DISC_ITEM + MIN_ITEM_SEL;
  2368.      }   
  2369.     else if(storage_type == USB_DEVICE){
  2370.        //SETUP_MEDIA_TYPE = USB_ITEM + 2;
  2371.        setup_sel[P][I] = USB_ITEM + MIN_ITEM_SEL;
  2372.     setup_VA[SETUP_VA_MEDIA_TYPE] = DISC_ITEM + MIN_ITEM_SEL;
  2373.     }   
  2374.     else{
  2375.         //SETUP_MEDIA_TYPE = CARD_ITEM + 2;
  2376.         setup_sel[P][I] = CARD_ITEM + MIN_ITEM_SEL;
  2377.      setup_VA[SETUP_VA_MEDIA_TYPE] = CARD_ITEM + MIN_ITEM_SEL;
  2378.     }
  2379.     //run_save_sel_cmd(setup_VA[SETUP_VA_MEDIA_TYPE], SETUP_VA_MEDIA_TYPE);
  2380. }
  2381. #endif