23 $info = &$this->getid3->info;
25 $info[
'fileformat'] =
'pcd';
26 $info[
'video'][
'dataformat'] =
'pcd';
27 $info[
'video'][
'lossless'] =
false;
32 $PCDflags = $this->
fread(1);
33 $PCDisVertical = ((ord($PCDflags) & 0x01) ?
true :
false);
37 $info[
'video'][
'resolution_x'] = 3072;
38 $info[
'video'][
'resolution_y'] = 2048;
40 $info[
'video'][
'resolution_x'] = 2048;
41 $info[
'video'][
'resolution_y'] = 3072;
45 if ($this->ExtractData > 3) {
47 $this->
error(
'Cannot extract PSD image data for detail levels above BASE (level-3) because encrypted with Kodak-proprietary compression/encryption.');
49 } elseif ($this->ExtractData > 0) {
51 $PCD_levels[1] =
array( 192, 128, 0x02000);
52 $PCD_levels[2] =
array( 384, 256, 0x0B800);
53 $PCD_levels[3] =
array( 768, 512, 0x30000);
58 list($PCD_width, $PCD_height, $PCD_dataOffset) = $PCD_levels[3];
60 $this->
fseek(
$info[
'avdataoffset'] + $PCD_dataOffset);
62 for (
$y = 0;
$y < $PCD_height;
$y += 2) {
69 $PCD_data_Y1 = $this->
fread($PCD_width);
70 $PCD_data_Y2 = $this->
fread($PCD_width);
71 $PCD_data_Cb = $this->
fread(intval(round($PCD_width / 2)));
72 $PCD_data_Cr = $this->
fread(intval(round($PCD_width / 2)));
74 for (
$x = 0;
$x < $PCD_width;
$x++) {
76 $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)}));
77 $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)}));
79 $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)}));
80 $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)}));
103 static $YCbCr_constants =
array();
104 if (empty($YCbCr_constants)) {
105 $YCbCr_constants[
'red'][
'Y'] = 0.0054980 * 256;
106 $YCbCr_constants[
'red'][
'Cb'] = 0.0000000 * 256;
107 $YCbCr_constants[
'red'][
'Cr'] = 0.0051681 * 256;
108 $YCbCr_constants[
'green'][
'Y'] = 0.0054980 * 256;
109 $YCbCr_constants[
'green'][
'Cb'] = -0.0015446 * 256;
110 $YCbCr_constants[
'green'][
'Cr'] = -0.0026325 * 256;
111 $YCbCr_constants[
'blue'][
'Y'] = 0.0054980 * 256;
112 $YCbCr_constants[
'blue'][
'Cb'] = 0.0079533 * 256;
113 $YCbCr_constants[
'blue'][
'Cr'] = 0.0000000 * 256;
116 $RGBcolor =
array(
'red'=>0,
'green'=>0,
'blue'=>0);
117 foreach ($RGBcolor as $rgbname => $dummy) {
118 $RGBcolor[$rgbname] = max(0,
122 ($YCbCr_constants[$rgbname][
'Y'] * $Y) +
123 ($YCbCr_constants[$rgbname][
'Cb'] * ($Cb - 156)) +
124 ($YCbCr_constants[$rgbname][
'Cr'] * ($Cr - 137))
130 return (($RGBcolor[
'red'] * 65536) + ($RGBcolor[
'green'] * 256) + $RGBcolor[
'blue']);
getID3() by James Heinrich info@getid3.org //
Create styles array
The data for the language used.
fseek($bytes, $whence=SEEK_SET)