-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is no possibility to forward the csc matrix to linux-sunxi kernel display driver directly with VDPAU. We have to set the values for brightness, saturation, contrast and hue via ioctl. But there are no attributes for these values in VDOAU to get them directly. So we need to do some reverse calculation to get these values out of the (changed) csc matrix. The old calculation was wrong and is now corrected to get the right values for brightness, saturation, contrast and hue. Due to the reverse calculation algorithm it's not possible to get all values for every scenario. This usecase is documented in the source code. Note: The linux-sunxi 3.4 kernel is buggy when doing this calculations. So in order to get this work correctly, you have to patch it or use an already patched kernel.
- Loading branch information
Showing
4 changed files
with
263 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (c) 2015-2016 Andreas Baierl <ichgeh@imkreisrum.de> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
* | ||
*/ | ||
|
||
#ifndef __CSC_H__ | ||
#define __CSC_H__ | ||
|
||
#include "vdpau_private.h" | ||
|
||
typedef float csc_m[3][4]; | ||
|
||
#ifdef CSC_FULL_RANGE | ||
/* | ||
* This matrizes are from vl_csc.c from the mesa project | ||
* The calculation routines are there, too. | ||
*/ | ||
|
||
/* Full range: RGB is in 0~255 */ | ||
static const csc_m cs_bt601 = { | ||
{ 1.164f, 0.0f, 1.596f, 0.0f, }, | ||
{ 1.164f, -0.391f, -0.813f, 0.0f, }, | ||
{ 1.164f, 2.018f, 0.0f, 0.0f, } | ||
}; | ||
static const csc_m cs_bt709 = { | ||
{ 1.164f, 0.0f, 1.793f, 0.0f, }, | ||
{ 1.164f, -0.213f, -0.534f, 0.0f, }, | ||
{ 1.164f, 2.115f, 0.0f, 0.0f, } | ||
}; | ||
static const csc_m cs_smpte_240m = { | ||
{ 1.164f, 0.0f, 1.794f, 0.0f, }, | ||
{ 1.164f, -0.258f, -0.543f, 0.0f, }, | ||
{ 1.164f, 2.079f, 0.0f, 0.0f, } | ||
}; | ||
const float ybias = -16.0f / 255.0f; | ||
#else | ||
/* Normal range: RGB is in 16~235 */ | ||
static const csc_m cs_bt601 = { | ||
{ 1.0f, 0.0f, 1.371f, 0.0f, }, | ||
{ 1.0f, -0.336f, -0.698f, 0.0f, }, | ||
{ 1.0f, 1.732f, 0.0f, 0.0f, } | ||
}; | ||
static const csc_m cs_bt709 = { | ||
{ 1.0f, 0.0f, 1.540f, 0.0f, }, | ||
{ 1.0f, -0.183f, -0.459f, 0.0f, }, | ||
{ 1.0f, 1.816f, 0.0f, 0.0f, } | ||
}; | ||
static const csc_m cs_smpte_240m = { | ||
{ 1.0f, 0.0f, 1.582f, 0.0f, }, | ||
{ 1.0f, -0.228f, -0.478f, 0.0f, }, | ||
{ 1.0f, 1.833f, 0.0f, 0.0f, } | ||
}; | ||
static const float ybias = 0.0f; | ||
#endif | ||
const float cbbias = -128.0f / 255.0f; | ||
const float crbias = -128.0f / 255.0f; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.