| Re: [hatari-devel] Less dark doubled TV-monitor mode for 32-bit output | 
[ Thread Index | 
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
] 
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Less dark doubled TV-monitor mode for 32-bit output
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Mon, 4 Nov 2019 10:51:27 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017;	t=1572861089; bh=eDhzAlidiqlsrZxy+Z1F2r7NvsZGKQgVKMVswJhHoU8=;	h=Date:From:To:Subject:From;	b=WYe3fVNvTsj+pERmZtuep7KZ9nBIvgFXC560dJasYLacuXwwFdEN3+WfsjDbn1jt6	 d8Gwf/VhGlU2SEKKryM3d8EGGeNJzRWj10J7opXpFNyWMYt3F32bxJ9PH+ZsWM2Vgm	 SCbzXhvx3YcYrhXe3RFZR2jv0x2BkTkB/ykQxoh3O5IL3YTc0WOTi7tlviPncyEwjE	 0oXXMjrHHuiTwfColFc6TPjlSZF7UcFMiPuwlcSOJQ6nPKYfxzqweaRZCG/cgevOAS	 EoupVdnKPBDG0hKvPCn3LEr34H0UaSo2+d/yMLzMgTSB3bPrfCCUyWygPYuq5c8OAv	 Yx+V2F+JXJCuQ==
Am Sat, 2 Nov 2019 01:13:11 +0200
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
> Hi,
> 
> On 10/31/19 12:59 AM, Eero Tamminen wrote:
> > What do you think of the attached change for making
> > doubled TV-monitor mode less dark on 32-bit output?
> 
> Attached are two patches doing it the way I actually wanted to do it.
> 
> First patch simplifies screen conversion Y-doubling code by removing
> lot of repeated code from inner loops and adding a function for
> doing the same in outer conversion loop.
> 
> After that, halving doubled line intensity for TV-mode needs to
> be done only in single place (second patch).
> 
> Comments?
This code is likely not endianess safe:
+			/* duplicate line pixels get half the intensity of
+			 * above line's pixels R/G/B channels (A is skipped)
+			 */
+			*next++ = *line++ >> 1;
+			*next++ = *line++ >> 1;
+			*next++ = *line++ >> 1;
+			next++; line++;
You have to use the values from SDL_PixelFormat if you want to make it
run properly everywhere. And I think you could do it with 32-bit
arithmetics to speed things up, instead of doing it byte by byte.
 Thomas