added horizontal overlay pre-downscaling so output can now scale downto 1/16th. Y-downscaling yet todo..

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14211 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen
2005-09-20 15:31:17 +00:00
parent 19c9c0bb0e
commit 975cd0c019
+47 -9
View File
@@ -1,4 +1,4 @@
/* Nvidia TNT and GeForce Back End Scaler functions */ /* VIA Unichrome Back End Scaler functions */
/* Written by Rudolf Cornelissen 05/2002-9/2005 */ /* Written by Rudolf Cornelissen 05/2002-9/2005 */
#define MODULE_BIT 0x00000200 #define MODULE_BIT 0x00000200
@@ -542,6 +542,8 @@ status_t eng_configure_bes
(ob->width - si->overlay.myBufInfo[offset].slopspace), ob->height)); (ob->width - si->overlay.myBufInfo[offset].slopspace), ob->height));
LOG(4,("Overlay: output picture width = %d, height = %d\n", ow->width, ow->height)); LOG(4,("Overlay: output picture width = %d, height = %d\n", ow->width, ow->height));
/* preset X and Y prescaling to be 1x */
minictrl = 0x00000000;
/* determine interval representation value, taking zoom into account */ /* determine interval representation value, taking zoom into account */
if (ow->flags & B_OVERLAY_HORIZONTAL_FILTERING) if (ow->flags & B_OVERLAY_HORIZONTAL_FILTERING)
{ {
@@ -591,17 +593,53 @@ status_t eng_configure_bes
hiscalv = 0x00002000; hiscalv = 0x00002000;
LOG(4,("Overlay: horizontal scaling factor too large, clamping at %f\n", (float)65536 / hiscalv)); LOG(4,("Overlay: horizontal scaling factor too large, clamping at %f\n", (float)65536 / hiscalv));
} }
/* VIA has a 'downscaling' limit of 1.0 /* VIA has a 'downscaling' limit of 1.0, but seperate prescaling to 1/16th can be done.
* (11bit register with 0.11 format value, with special 1.0 scaling factor setting) */ * (scaler has 11bit register with 0.11 format value, with special 1.0 scaling factor setting;
//fixme: add downscaling 'trick' solution as supported by VIA (1/16 is min. size). * prescaler has fixed 1x, 1/2x, 1/4x, 1/8x and 1/16x settings.) */
scale_x = true; if (hiscalv > 0x00100000)
if (hiscalv > 0x00010000)
{ {
/* (non-inverse) factor too small, set factor to min. valid value */ /* (non-inverse) factor too small, set factor to min. valid value */
hiscalv = 0x00010000; hiscalv = 0x00100000;
scale_x = false;
LOG(4,("Overlay: horizontal scaling factor too small, clamping at %f\n", (float)2048 / (hiscalv >> 5))); LOG(4,("Overlay: horizontal scaling factor too small, clamping at %f\n", (float)2048 / (hiscalv >> 5)));
} }
/* setup pre-downscaling if 'requested' */
if ((hiscalv > 0x00010000) && (hiscalv <= 0x00020000))
{
/* instruct BES to horizontal prescale 0.5x */
minictrl |= 0x01000000;
/* correct normal scalingfactor so total scaling is 0.5 <= factor < 1.0x */
hiscalv >>= 1;
}
else
if ((hiscalv > 0x00020000) && (hiscalv <= 0x00040000))
{
/* instruct BES to horizontal prescale 0.25x */
minictrl |= 0x03000000;
/* correct normal scalingfactor so total scaling is 0.5 <= factor < 1.0x */
hiscalv >>= 2;
}
else
if ((hiscalv > 0x00040000) && (hiscalv <= 0x00080000))
{
/* instruct BES to horizontal prescale 0.125x */
minictrl |= 0x05000000;
/* correct normal scalingfactor so total scaling is 0.5 <= factor < 1.0x */
hiscalv >>= 3;
}
else
if ((hiscalv > 0x00080000) && (hiscalv <= 0x00100000))
{
/* instruct BES to horizontal prescale 0.125x */
minictrl |= 0x07000000;
/* correct normal scalingfactor so total scaling is 0.5 <= factor < 1.0x */
hiscalv >>= 4;
}
/* only instruct normal scaler to scale if it must do so */
scale_x = true;
if (hiscalv == 0x00010000) scale_x = false;
/* AND below is required by hardware */ /* AND below is required by hardware */
hiscalv &= 0x0000ffe0; hiscalv &= 0x0000ffe0;
@@ -755,7 +793,7 @@ status_t eng_configure_bes
// else // else
// to small to handle (limit reached) // to small to handle (limit reached)
//rud +instruct VID1_MINI_CTL register about modified scaling. (V1_X_DIV_2 etc) //rud +instruct VID1_MINI_CTL register about modified scaling. (V1_X_DIV_2 etc)
minictrl = 0x00000000; // minictrl = 0x00000000;
/* enable horizontal filtering if asked for */ /* enable horizontal filtering if asked for */
if (ow->flags & B_OVERLAY_HORIZONTAL_FILTERING) if (ow->flags & B_OVERLAY_HORIZONTAL_FILTERING)
{ {