diff --git a/user_io.h b/user_io.h index 329e06f..dcbc2e8 100644 --- a/user_io.h +++ b/user_io.h @@ -59,7 +59,7 @@ #define UIO_TIMESTAMP 0x24 // transmit seconds since Unix epoch #define UIO_LEDS 0x25 // control on-board LEDs #define UIO_AUDVOL 0x26 // Digital volume as a number of bits to shift to the right -#define UIO_SETHEIGHT 0x27 // Set scaled vertical resolution (to reduce scaling artefacts) +#define UIO_SETHEIGHT 0x27 // Set max scaled vertical resolution #define UIO_GETUARTFLG 0x28 // Get UART_FLG_* #define UIO_GET_STATUS 0x29 // Update status from the core #define UIO_SET_FLTCOEF 0x2A // Set Scaler polyphase coefficients @@ -75,6 +75,7 @@ #define UIO_CD_GET 0x34 #define UIO_CD_SET 0x35 #define UIO_INFO_GET 0x36 +#define UIO_SETWIDTH 0x37 // Set max scaled horizontal resolution // codes as used by 8bit for file loading from OSD #define UIO_FILE_TX 0x53 diff --git a/video.cpp b/video.cpp index e259636..006926e 100644 --- a/video.cpp +++ b/video.cpp @@ -646,33 +646,47 @@ static uint32_t show_video_info(int force) } uint32_t scrh = v_cur.item[5]; - if (height && scrh) + if (scrh) { - if (cfg.vscale_border) - { - uint32_t border = cfg.vscale_border * 2; - if ((border + 100) > scrh) border = scrh - 100; - scrh -= border; - } - - if (cfg.vscale_mode) + if (cfg.vscale_mode && height) { uint32_t div = 1 << (cfg.vscale_mode - 1); uint32_t mag = (scrh*div) / height; scrh = (height * mag) / div; - } - - if(cfg.vscale_border || cfg.vscale_mode) - { printf("Set vertical scaling to : %d\n", scrh); spi_uio_cmd16(UIO_SETHEIGHT, scrh); } + else if(cfg.vscale_border) + { + uint32_t border = cfg.vscale_border * 2; + if ((border + 100) > scrh) border = scrh - 100; + scrh -= border; + printf("Set max vertical resolution to : %d\n", scrh); + spi_uio_cmd16(UIO_SETHEIGHT, scrh); + } else { spi_uio_cmd16(UIO_SETHEIGHT, 0); } } + uint32_t scrw = v_cur.item[1]; + if (scrw) + { + if (cfg.vscale_border && !(cfg.vscale_mode && height)) + { + uint32_t border = cfg.vscale_border * 2; + if ((border + 100) > scrw) border = scrw - 100; + scrw -= border; + printf("Set max horizontal resolution to : %d\n", scrw); + spi_uio_cmd16(UIO_SETWIDTH, scrw); + } + else + { + spi_uio_cmd16(UIO_SETWIDTH, 0); + } + } + if (vtime && vtimeh) ret = vtime; minimig_set_adjust(2); }