From patchwork Wed Mar 30 11:48:52 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Cap X-Patchwork-Id: 11835 Received: from smtp.compuserve.de ([62.52.27.101] helo=lnxc-641.srv.mediaways.net) by www.linuxtv.org with smtp (Exim 4.34) id 1DGbgc-0000v9-Iw for vdr@linuxtv.org; Wed, 30 Mar 2005 13:48:38 +0200 Received: (qmail 18523 invoked by uid 501); 30 Mar 2005 11:48:44 -0000 X-Authenticated-Sender: macap20001 Received: from dsl-084-058-017-094.arcor-ip.net (dsl-084-058-017-094.arcor-ip.net [84.58.17.94]) by compuserve.de ([10.228.3.105]) with ESMTP via TCP; 30 Mar 2005 11:48:44 -0000 Message-ID: <424A9224.4000608@compuserve.de> Date: Wed, 30 Mar 2005 13:48:52 +0200 From: Martin Cap User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 Thunderbird/0.7 Mnenhy/0.6.0.101 X-Accept-Language: de-de, en-us, en MIME-Version: 1.0 To: vdr@linuxtv.org Subject: [vdr] Patch: dxr3plugin OSD don't turn pink X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2005 11:48:38 -0000 Status: O X-Status: X-Keywords: X-UID: 1242 Hi ML, Hi dxr3plugin lovers, Attached to this posting is a patch which fixes the odd problem making the osd turn pink after returning from mplayer or after hardware-reset of the dxr3-card. I posted this fix in a german-vdr-forum a couple of months ago and it works for other users there, too. I haven't found the time to post it here (other users hadn't either:) )... so, here it is. Now what this patch does is it changes some behavior of cDxr3PaletteManager. It seems, that after returning from pmExtern_THIS_SHOULD_BE_AVOIDED, palette-data in cDxr3PaletteManager is somehow broken after resuscitation (whatever happens there, the code is a total mess). I avoid this by *not* converting the whole data allover again in cDxr3PaletteManager::GetPalette() through Tools::Rgb2YCrCb() and copy it to m_pal (only when palette-data has changed, indicated by member m_changed, should speed up the whole process a bit additionally). This patch may be applied to current CVS (HEAD or MAIN, also vdr-dxr3-0-2). Give it a shot ! Bye, diff -Nur dxr3/dxr3palettemanager.c dxr3_orig/dxr3palettemanager.c --- dxr3/dxr3palettemanager.c 2005-03-30 13:39:03.494069720 +0200 +++ dxr3_orig/dxr3palettemanager.c 2005-03-30 13:41:07.113276744 +0200 @@ -17,12 +17,12 @@ // ================================== //! constructor -cDxr3PaletteManager::cDxr3PaletteManager() : - m_changed(false) +cDxr3PaletteManager::cDxr3PaletteManager() { memset(m_colors, 0, sizeof(int) * MAX_COLORS); memset(m_users, 0, sizeof(int) * MAX_COLORS); - memset(m_pal, 0, sizeof(uint32_t) * MAX_COLORS); + memset(m_pal, 0, sizeof(int) * MAX_COLORS); + m_changed = false; }; // ================================== @@ -31,8 +31,6 @@ int freeIndex = MAX_COLORS; bool found = false; - m_changed = false; - for (int i = 0; i < MAX_COLORS && !found; ++i) { if (color == m_colors[i]) @@ -58,17 +56,12 @@ void cDxr3PaletteManager::RemoveColor(int color) { bool found = false; - - m_changed = false; - for (int i = 0; i < MAX_COLORS && !found; ++i) { if (color == m_colors[i]) { if (m_users[i] > 0) --m_users[i]; - m_changed = found = true; - - + found = true; } } } @@ -78,15 +71,12 @@ { bool found = false; int index = 0; - - m_changed = false; - for (int i = 0; i < MAX_COLORS && !found; ++i) { if (color == m_colors[i]) { index = i; - m_changed = found = true; + found = true; } } return index; @@ -102,29 +92,24 @@ int cDxr3PaletteManager::operator[](int index) { assert(index < MAX_COLORS && index > 0); - return m_colors[index]; } // ================================== bool cDxr3PaletteManager::HasChanged() { -// bool retval = m_changed; -// m_changed = false; - return m_changed; + bool retval = m_changed; + m_changed = false; + return retval; } // ================================== uint32_t* cDxr3PaletteManager::GetPalette() { - if(m_changed) - { - for (int i = 0; i < MAX_COLORS; ++i) - { - m_pal[i] = Tools::Rgb2YCrCb(m_colors[i]); - } - } - + for (int i = 0; i < MAX_COLORS; ++i) + { + m_pal[i] = Tools::Rgb2YCrCb(m_colors[i]); + } + return m_pal; } -