GetId3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //.
More...
GetId3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //.
module for analyzing PhotoCD (PCD) Image files
- Author
- James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g http://www.getid3.org
Definition at line 28 of file Pcd.php.
◆ analyze()
GetId3\Module\Graphic\Pcd::analyze |
( |
| ) |
|
Definition at line 39 of file Pcd.php.
References $info, $x, $y, array, GetId3\Handler\BaseHandler\fread(), GetId3\Handler\BaseHandler\fseek(), and GetId3\Module\Graphic\Pcd\YCbCr2RGB().
41 $info = &$this->getid3->info;
43 $info[
'fileformat'] =
'pcd';
44 $info[
'video'][
'dataformat'] =
'pcd';
45 $info[
'video'][
'lossless'] =
false;
47 fseek($this->getid3->fp,
$info[
'avdataoffset'] + 72, SEEK_SET);
49 $PCDflags =
fread($this->getid3->fp, 1);
50 $PCDisVertical = ((ord($PCDflags) & 0x01) ?
true :
false);
53 $info[
'video'][
'resolution_x'] = 3072;
54 $info[
'video'][
'resolution_y'] = 2048;
56 $info[
'video'][
'resolution_x'] = 2048;
57 $info[
'video'][
'resolution_y'] = 3072;
60 if ($this->ExtractData > 3) {
62 $info[
'error'][] =
'Cannot extract PSD image data for detail levels above BASE (level-3) because encrypted with Kodak-proprietary compression/encryption.';
64 } elseif ($this->ExtractData > 0) {
66 $PCD_levels[1] =
array( 192, 128, 0x02000);
67 $PCD_levels[2] =
array( 384, 256, 0x0B800);
68 $PCD_levels[3] =
array( 768, 512, 0x30000);
73 list($PCD_width, $PCD_height, $PCD_dataOffset) = $PCD_levels[3];
75 fseek($this->getid3->fp,
$info[
'avdataoffset'] + $PCD_dataOffset, SEEK_SET);
77 for (
$y = 0;
$y < $PCD_height;
$y += 2) {
84 $PCD_data_Y1 =
fread($this->getid3->fp, $PCD_width);
85 $PCD_data_Y2 =
fread($this->getid3->fp, $PCD_width);
86 $PCD_data_Cb =
fread($this->getid3->fp, intval(round($PCD_width / 2)));
87 $PCD_data_Cr =
fread($this->getid3->fp, intval(round($PCD_width / 2)));
89 for (
$x = 0;
$x < $PCD_width;
$x++) {
91 $info[
'pcd'][
'data'][$PCD_width -
$x][
$y] = $this->
YCbCr2RGB(ord($PCD_data_Y1{
$x}), ord($PCD_data_Cb{floor(
$x / 2)}), ord($PCD_data_Cr{floor(
$x / 2)}));
92 $info[
'pcd'][
'data'][$PCD_width -
$x][
$y + 1] = $this->
YCbCr2RGB(ord($PCD_data_Y2{
$x}), ord($PCD_data_Cb{floor(
$x / 2)}), ord($PCD_data_Cr{floor(
$x / 2)}));
94 $info[
'pcd'][
'data'][
$y][
$x] = $this->
YCbCr2RGB(ord($PCD_data_Y1{
$x}), ord($PCD_data_Cb{floor(
$x / 2)}), ord($PCD_data_Cr{floor(
$x / 2)}));
95 $info[
'pcd'][
'data'][
$y + 1][
$x] = $this->
YCbCr2RGB(ord($PCD_data_Y2{
$x}), ord($PCD_data_Cb{floor(
$x / 2)}), ord($PCD_data_Cr{floor(
$x / 2)}));
fseek($bytes, $whence=SEEK_SET)
YCbCr2RGB($Y, $Cb, $Cr)
array $YCbCr_constants
Create styles array
The data for the language used.
◆ YCbCr2RGB()
GetId3\Module\Graphic\Pcd::YCbCr2RGB |
( |
|
$Y, |
|
|
|
$Cb, |
|
|
|
$Cr |
|
) |
| |
array $YCbCr_constants
- Parameters
-
- Returns
- type
Definition at line 125 of file Pcd.php.
References array.
Referenced by GetId3\Module\Graphic\Pcd\analyze().
127 static $YCbCr_constants =
array();
128 if (empty($YCbCr_constants)) {
129 $YCbCr_constants[
'red'][
'Y'] = 0.0054980 * 256;
130 $YCbCr_constants[
'red'][
'Cb'] = 0.0000000 * 256;
131 $YCbCr_constants[
'red'][
'Cr'] = 0.0051681 * 256;
132 $YCbCr_constants[
'green'][
'Y'] = 0.0054980 * 256;
133 $YCbCr_constants[
'green'][
'Cb'] = -0.0015446 * 256;
134 $YCbCr_constants[
'green'][
'Cr'] = -0.0026325 * 256;
135 $YCbCr_constants[
'blue'][
'Y'] = 0.0054980 * 256;
136 $YCbCr_constants[
'blue'][
'Cb'] = 0.0079533 * 256;
137 $YCbCr_constants[
'blue'][
'Cr'] = 0.0000000 * 256;
140 $RGBcolor =
array(
'red'=>0,
'green'=>0,
'blue'=>0);
141 foreach ($RGBcolor as $rgbname => $dummy) {
142 $RGBcolor[$rgbname] = max(0,
146 ($YCbCr_constants[$rgbname][
'Y'] * $Y) +
147 ($YCbCr_constants[$rgbname][
'Cb'] * ($Cb - 156)) +
148 ($YCbCr_constants[$rgbname][
'Cr'] * ($Cr - 137))
155 return (($RGBcolor[
'red'] * 65536) + ($RGBcolor[
'green'] * 256) + $RGBcolor[
'blue']);
Create styles array
The data for the language used.
◆ $ExtractData
GetId3\Module\Graphic\Pcd::$ExtractData = 0 |
The documentation for this class was generated from the following file:
- libs/composer/vendor/phansys/getid3/GetId3/Module/Graphic/Pcd.php