~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to prnt/hpcups/LJZjStream.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-12-14 20:08:44 UTC
  • mfrom: (2.1.118 lucid)
  • Revision ID: james.westby@ubuntu.com-20091214200844-z8qhqwgppbu3t7ze
Tags: 3.9.10-4
KBSD patch from KiBi (Closes: #560796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************\
 
2
  LJZjStream.cpp : Implementation for the LJZjStream class
 
3
 
 
4
  Copyright (c) 1996 - 2009, Hewlett-Packard Co.
 
5
  All rights reserved.
 
6
 
 
7
  Redistribution and use in source and binary forms, with or without
 
8
  modification, are permitted provided that the following conditions
 
9
  are met:
 
10
  1. Redistributions of source code must retain the above copyright
 
11
     notice, this list of conditions and the following disclaimer.
 
12
  2. Redistributions in binary form must reproduce the above copyright
 
13
     notice, this list of conditions and the following disclaimer in the
 
14
     documentation and/or other materials provided with the distribution.
 
15
  3. Neither the name of Hewlett-Packard nor the names of its
 
16
     contributors may be used to endorse or promote products derived
 
17
     from this software without specific prior written permission.
 
18
 
 
19
  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
 
20
  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 
21
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
 
22
  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
23
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 
24
  TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 
25
  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 
26
  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
27
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 
28
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
29
\*****************************************************************************/
 
30
 
 
31
#include "CommonDefinitions.h"
 
32
#include "Pipeline.h"
 
33
#include "Encapsulator.h"
 
34
#include "ColorMatcher.h"
 
35
#include "Halftoner.h"
 
36
#include "ModeJbig.h"
 
37
#include "resources.h"
 
38
#include "ColorMaps.h"
 
39
#include "PrinterCommands.h"
 
40
#include "LJZjStream.h"
 
41
#include "Utils.h"
 
42
#include "hpjbig_wrapper.h"
 
43
 
 
44
#define ZJC_BAND_HEIGHT    100
 
45
 
 
46
LJZjStream::LJZjStream () : Encapsulator ()
 
47
{
 
48
    memset(&m_PM, 0, sizeof(m_PM));
 
49
    strcpy(m_szLanguage, "ZJS");
 
50
    m_pModeJbig = NULL;
 
51
    m_bNotSent = true;
 
52
}
 
53
 
 
54
LJZjStream::~LJZjStream()
 
55
{
 
56
}
 
57
 
 
58
DRIVER_ERROR LJZjStream::addJobSettings()
 
59
{
 
60
    BYTE    cItems[3] = {ZJI_DMCOLLATE, ZJI_PAGECOUNT, ZJI_DMDUPLEX};
 
61
    addToHeader("%s", "\x1B\x25-12345X@PJL ENTER LANGUAGE=ZJS\x0AJZJZ");
 
62
    BYTE    *p = cur_pcl_buffer_ptr;
 
63
    p[3] = 52;
 
64
    p[7] = ZJT_START_DOC;
 
65
    p[11] = 3;
 
66
    p[13] = 36;
 
67
    p[14] = 'Z';
 
68
    p[15] = 'Z';
 
69
    int    i = 16;
 
70
    for (int j = 0; j < 3; j++)
 
71
    {
 
72
        p[i + 3] = 12;
 
73
        p[i + 5] = cItems[j];
 
74
        p[i + 6] = ZJIT_UINT32;
 
75
        p[i + 11] = j / 2;
 
76
        i += 12;
 
77
    }
 
78
    cur_pcl_buffer_ptr += i;
 
79
    DRIVER_ERROR err = Cleanup();
 
80
    return err;
 
81
}
 
82
 
 
83
DRIVER_ERROR LJZjStream::Configure(Pipeline **pipeline)
 
84
{
 
85
    DRIVER_ERROR err;
 
86
    Pipeline    *p = NULL;
 
87
    Pipeline    *head;
 
88
    unsigned int width;
 
89
    ColorMatcher *pColorMatcher;
 
90
    Halftoner    *pHalftoner;
 
91
    int          iRows[MAXCOLORPLANES];
 
92
    unsigned int uiResBoost;
 
93
    head = *pipeline;
 
94
 
 
95
/*
 
96
 *  I need a flag in the printmode structure to whether create a CMYGraymap
 
97
 *  and set the ulMap1 to it.
 
98
 */
 
99
 
 
100
    m_PM.BaseResX = m_pQA->horizontal_resolution;
 
101
    m_PM.BaseResY = m_pQA->vertical_resolution;
 
102
    m_PM.eHT = FED;
 
103
    m_PM.MixedRes = false;
 
104
    m_PM.BlackFEDTable = HTBinary_open;
 
105
    if (m_pJA->color_mode == 0)
 
106
    {
 
107
        m_PM.cmap.ulMap1 = NULL;
 
108
        m_PM.cmap.ulMap2 = NULL;
 
109
        m_PM.cmap.ulMap3 = ucMapDJ4100_KCMY_Photo_BestA_12x12x1;
 
110
        m_PM.dyeCount = 4;
 
111
        m_PM.ColorFEDTable = HT1200x1200x1PhotoBest_open;
 
112
    }
 
113
    else
 
114
    {
 
115
        m_PM.cmap.ulMap1 = ulMapDJ600_CCM_K;
 
116
        m_PM.dyeCount = 1;
 
117
        m_PM.ColorFEDTable = HTBinary_open;
 
118
    }
 
119
 
 
120
    for (int i = 0; i < MAXCOLORPLANES; i++)
 
121
    {
 
122
        m_PM.ColorDepth[i] = 1;
 
123
        m_PM.ResolutionX[i] = m_pQA->horizontal_resolution;
 
124
        m_PM.ResolutionY[i] = m_pQA->vertical_resolution;
 
125
        iRows[i] = m_PM.ResolutionX[i] / m_PM.BaseResX;
 
126
    }
 
127
 
 
128
    uiResBoost = m_PM.BaseResX / m_PM.BaseResY;
 
129
    if (uiResBoost == 0)
 
130
        uiResBoost = 1;
 
131
 
 
132
    width = m_pMA->printable_width;
 
133
 
 
134
    pColorMatcher = new ColorMatcher(m_PM.cmap, m_PM.dyeCount, width);
 
135
    head = new Pipeline(pColorMatcher);
 
136
    pHalftoner = new Halftoner (&m_PM, width, iRows, uiResBoost, m_PM.eHT == MATRIX);
 
137
    p = new Pipeline(pHalftoner);
 
138
    head->AddPhase(p);
 
139
    m_pModeJbig = new ModeJbig(width);
 
140
    p = new Pipeline(m_pModeJbig);
 
141
    head->AddPhase(p);
 
142
    m_pModeJbig->myplane = COLORTYPE_COLOR;
 
143
 
 
144
    m_iPlanes = 1;
 
145
    m_iBpp = 1;
 
146
    int    height = m_pMA->printable_height;
 
147
    ZJPLATFORM    ezj_platform = ZJSTREAM;
 
148
    if (!strcmp(m_pJA->printer_platform, "ljzjscolor"))
 
149
    {
 
150
        m_iBpp = 2;
 
151
        ezj_platform = ZJCOLOR;
 
152
        if (m_pJA->color_mode == 0)
 
153
        {
 
154
            m_iPlanes = 4;
 
155
        }
 
156
        height = ZJC_BAND_HEIGHT;
 
157
    }
 
158
    err = m_pModeJbig->Init(height, m_iPlanes, m_iBpp, ezj_platform);
 
159
 
 
160
    *pipeline = head;
 
161
    return err;
 
162
}
 
163
 
 
164
DRIVER_ERROR LJZjStream::StartPage (JobAttributes *pJA)
 
165
{
 
166
    DRIVER_ERROR        err = NO_ERROR;
 
167
    DWORD               dwNumItems = 14;
 
168
    BYTE                szStr[16 + 15 * 12];
 
169
    int                 i;
 
170
    int                 width;
 
171
 
 
172
    m_iPlaneNumber = 0;
 
173
    m_iCurRaster   = 0;
 
174
 
 
175
    width = ((m_pMA->printable_width + 31) / 32) * 32;
 
176
    if (m_pJA->color_mode == 0)
 
177
        dwNumItems++;
 
178
 
 
179
    i = 0;
 
180
    i += SendChunkHeader (szStr, 16 + dwNumItems * 12, ZJT_START_PAGE, dwNumItems);
 
181
    if (m_pJA->color_mode == 0)
 
182
    {
 
183
        i += SendItem (szStr+i, ZJIT_UINT32, ZJI_PLANE, m_iPlanes);
 
184
    }
 
185
 
 
186
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_DMPAPER, m_pMA->pcl_id);
 
187
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_DMCOPIES, 1);
 
188
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_DMDEFAULTSOURCE, m_pJA->media_source);
 
189
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_DMMEDIATYPE, m_pQA->media_type);
 
190
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_NBIE, m_iPlanes);
 
191
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_RESOLUTION_X, m_pQA->horizontal_resolution);
 
192
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_RESOLUTION_Y, m_pQA->vertical_resolution);
 
193
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_RASTER_X, width * m_iBpp);
 
194
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_RASTER_Y, m_pMA->printable_height);
 
195
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_VIDEO_BPP, m_iBpp);
 
196
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_VIDEO_X, width);
 
197
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_VIDEO_Y, m_pMA->printable_height);
 
198
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_RET, RET_ON);
 
199
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_TONER_SAVE, (m_pQA->print_quality == -1) ? 1 : 0);
 
200
 
 
201
    err = sendBuffer ((const BYTE *) szStr, i);
 
202
    return err;
 
203
}
 
204
 
 
205
DRIVER_ERROR LJZjStream::sendBlankBands()
 
206
{
 
207
    if (strcmp(m_pJA->printer_platform, "ljzjscolor"))
 
208
    {
 
209
        return NO_ERROR;
 
210
    }
 
211
    DRIVER_ERROR    err = NO_ERROR;
 
212
    int    remaining_rasters = m_pMA->printable_height - m_iCurRaster;
 
213
    int    num_planes = (m_pJA->color_mode == 0) ? 4 : 1;
 
214
    if (remaining_rasters <= 0)
 
215
    {
 
216
        return NO_ERROR;
 
217
    }
 
218
 
 
219
    RASTERDATA    raster_data;
 
220
    if (remaining_rasters < ZJC_BAND_HEIGHT)
 
221
    {
 
222
        memset(&raster_data, 0, sizeof(raster_data));
 
223
        m_pModeJbig->SetBandHeight(remaining_rasters);
 
224
        for (int k = 0; k < num_planes; k++)
 
225
        {
 
226
            m_pModeJbig->Flush();
 
227
            m_pModeJbig->NextOutputRaster(raster_data);
 
228
            err = Encapsulate(&raster_data, true);
 
229
            if (err != NO_ERROR)
 
230
                return err;
 
231
        }
 
232
        m_pModeJbig->SetBandHeight(ZJC_BAND_HEIGHT);
 
233
        return err;
 
234
    }
 
235
 
 
236
    memset(&raster_data, 0, sizeof(raster_data));
 
237
    m_pModeJbig->Process(&raster_data);
 
238
    m_pModeJbig->Flush();
 
239
    m_pModeJbig->NextOutputRaster(raster_data);
 
240
    while (remaining_rasters > 0)
 
241
    {
 
242
        for (int k = 0; k < num_planes; k++)
 
243
        {
 
244
            err = Encapsulate(&raster_data, true);
 
245
            if (err != NO_ERROR)
 
246
            {
 
247
                return err;
 
248
            }
 
249
        }
 
250
        remaining_rasters -= ZJC_BAND_HEIGHT;
 
251
    }
 
252
    if (remaining_rasters <= 0)
 
253
    {
 
254
        return NO_ERROR;
 
255
    }
 
256
 
 
257
    memset(&raster_data, 0, sizeof(raster_data));
 
258
    m_pModeJbig->SetBandHeight(remaining_rasters);
 
259
    m_pModeJbig->Process(&raster_data);
 
260
    m_pModeJbig->Flush();
 
261
    m_pModeJbig->NextOutputRaster(raster_data);
 
262
    for (int k = 0; k < num_planes; k++)
 
263
    {
 
264
        err = Encapsulate(&raster_data, true);
 
265
    }
 
266
    m_pModeJbig->SetBandHeight(ZJC_BAND_HEIGHT);
 
267
 
 
268
    return err;
 
269
}
 
270
 
 
271
DRIVER_ERROR LJZjStream::FormFeed ()
 
272
{
 
273
    DRIVER_ERROR        err = NO_ERROR;
 
274
    BYTE                szStr[128];
 
275
    int                 size = 16;
 
276
 
 
277
    err = sendBlankBands();
 
278
    if (err != NO_ERROR)
 
279
        return err;
 
280
 
 
281
    SendChunkHeader (szStr, 16, ZJT_END_PAGE, 0);
 
282
    if (!strcmp(m_pJA->printer_platform, "ljzjscolor"))
 
283
    {
 
284
        int                 i = 0;
 
285
        int                 iCol = (m_pJA->color_mode == 0) ? 1 : 0;
 
286
 
 
287
        memset(szStr, 0, sizeof(szStr));
 
288
        i = SendChunkHeader (szStr, 112, ZJT_END_PAGE, 8);
 
289
        for (int j = 0; j < 8; j++)
 
290
        {
 
291
            i += SendItem (szStr+i, ZJIT_UINT32, 0x8200+j, (j % 4 == 3) ? 1 : iCol);
 
292
        }
 
293
        size = 112;
 
294
    }
 
295
 
 
296
    err = sendBuffer ((const BYTE *) szStr, size);
 
297
 
 
298
    return err;
 
299
}
 
300
 
 
301
DRIVER_ERROR LJZjStream::EndJob()
 
302
{
 
303
    BYTE    szStr[16];
 
304
    memset(szStr, 0, sizeof(szStr));
 
305
    szStr[3] = 16;
 
306
    szStr[7] = ZJT_END_DOC;
 
307
    szStr[14] = 'Z';
 
308
    szStr[15] = 'Z';
 
309
    return this->sendBuffer((const BYTE *) szStr, 16);
 
310
}
 
311
 
 
312
DRIVER_ERROR    LJZjStream::Encapsulate (RASTERDATA *raster, bool bLastPlane)
 
313
{
 
314
if (raster->rasterdata[COLORTYPE_COLOR] == NULL || raster->rastersize[COLORTYPE_COLOR] == 0)
 
315
{
 
316
    return NO_ERROR;
 
317
}
 
318
    if (!strcmp(m_pJA->printer_platform, "ljzjscolor"))
 
319
    {
 
320
        return encapsulateColor(raster);
 
321
    }
 
322
 
 
323
    DRIVER_ERROR        err = NO_ERROR;
 
324
    BYTE                szStr[36];
 
325
    int                 i = 0;
 
326
    int                 iTotalSize = raster->rastersize[COLORTYPE_COLOR];
 
327
 
 
328
/*
 
329
 *  Send JBIG header info
 
330
 */
 
331
 
 
332
    i = SendChunkHeader (szStr, 36, ZJT_JBIG_BIH, 0);
 
333
 
 
334
    memcpy (szStr + 16, raster->rasterdata[COLORTYPE_COLOR], 20);
 
335
    err = sendBuffer ((const BYTE *) szStr, 36);
 
336
    ERRCHECK;
 
337
 
 
338
    iTotalSize -= 20;
 
339
    int     iPadCount = 0;
 
340
    if (iTotalSize % 16)
 
341
    {
 
342
        iPadCount = ((iTotalSize / 16 + 1) * 16) - iTotalSize;
 
343
    }
 
344
    int      dwTotal = iTotalSize;
 
345
    BYTE     *p = raster->rasterdata[COLORTYPE_COLOR] + 20;
 
346
    i = dwTotal / 65536;
 
347
 
 
348
    for (int j = 0; j < i; j++)
 
349
    {
 
350
        SendChunkHeader (szStr, 16 + 65536, ZJT_JBIG_HID, 0);
 
351
        err = sendBuffer ((const BYTE *) szStr, 16);
 
352
        ERRCHECK;
 
353
        err = sendBuffer ((const BYTE *) p, 65536);
 
354
        ERRCHECK;
 
355
        dwTotal -= 65536;
 
356
        p += 65536;
 
357
    }
 
358
    i = SendChunkHeader (szStr, 16 + dwTotal + iPadCount, ZJT_JBIG_HID, 0);
 
359
    err = sendBuffer ((const BYTE *) szStr, 16);
 
360
    ERRCHECK;
 
361
    err = sendBuffer ((const BYTE *) p, dwTotal);
 
362
    ERRCHECK;
 
363
    if (iPadCount != 0)
 
364
    {
 
365
        memset (szStr, 0, iPadCount);
 
366
        err = sendBuffer ((const BYTE *) szStr, iPadCount);
 
367
    }
 
368
    i = SendChunkHeader (szStr, 16, ZJT_END_JBIG, 0);
 
369
    if (err == NO_ERROR)
 
370
        err = sendBuffer ((const BYTE *) szStr, 16);
 
371
    err = Cleanup();
 
372
    return err;
 
373
}
 
374
 
 
375
DRIVER_ERROR    LJZjStream::encapsulateColor (RASTERDATA *raster)
 
376
{
 
377
    bool            bLastStride = true;
 
378
    int             kEnd = 2;
 
379
    DRIVER_ERROR    err = NO_ERROR;
 
380
    BYTE            szStr[256];
 
381
    int             i = 0;
 
382
 
 
383
    HPLJZjsJbgEncSt     *se = (HPLJZjsJbgEncSt *) (raster->rasterdata[COLORTYPE_COLOR] + raster->rastersize[COLORTYPE_COLOR]);
 
384
 
 
385
    if (m_pJA->color_mode == 0)
 
386
    {
 
387
        kEnd = 5;
 
388
    }
 
389
    if (m_iPlaneNumber == 0 || m_pJA->color_mode != 0)
 
390
        m_iCurRaster += se->yd;
 
391
    if (m_iCurRaster < m_pMA->printable_height)
 
392
    {
 
393
        bLastStride = false;
 
394
    }
 
395
 
 
396
 
 
397
/*
 
398
 *  Send JBIG header info
 
399
 */
 
400
 
 
401
    // Send out the JBIG header if first plane and it hasn't already been sent out yet.
 
402
    if (m_iPlaneNumber == 0 && m_bNotSent)
 
403
    {
 
404
        m_bNotSent = false;
 
405
        i = 0;
 
406
        for (int k = 1; k < kEnd; k++)
 
407
        {
 
408
            i = SendChunkHeader (szStr, 132, ZJT_BITMAP, 8);
 
409
            szStr[13] += 20;
 
410
            i += SendItem (szStr+i, ZJIT_UINT32, ZJI_BITMAP_TYPE, 1);
 
411
            i += SendItem (szStr+i, ZJIT_UINT32, ZJI_BITMAP_PIXELS, se->xd);
 
412
            i += SendItem (szStr+i, ZJIT_UINT32, ZJI_BITMAP_STRIDE, se->xd);
 
413
            i += SendItem (szStr+i, ZJIT_UINT32, ZJI_BITMAP_LINES, se->yd);
 
414
            i += SendItem (szStr+i, ZJIT_UINT32, ZJI_BITMAP_BPP, 1);
 
415
            i += SendItem (szStr+i, ZJIT_UINT32, ZJI_VIDEO_BPP, m_iBpp);
 
416
            i += SendItem (szStr+i, ZJIT_UINT32, ZJI_PLANE,
 
417
                           (m_pJA->color_mode == 0) ? k : 4);
 
418
            i += SendItemExtra (szStr+i, ZJIT_BYTELUT, ZJI_ENCODING_DATA, 20, 20);
 
419
            szStr[i++] = se->dl;
 
420
            szStr[i++] = se->d;
 
421
            szStr[i++] = se->planes;
 
422
            szStr[i++] = 0;
 
423
            for (int j = 3; j >= 0; j--)
 
424
            {
 
425
                szStr[i] = (BYTE) ((se->xd  >> (8 * j)) & 0xFF);
 
426
                szStr[4+i] = (BYTE) ((se->yd  >> (8 * j)) & 0xFF);
 
427
                szStr[8+i] = (BYTE) ((se->l0  >> (8 * j)) & 0xFF);
 
428
                i++;
 
429
            }
 
430
            i += 8;
 
431
 
 
432
            szStr[i++] = se->mx;
 
433
            szStr[i++] = se->my;
 
434
            szStr[i++] = se->order;
 
435
            szStr[i++] = se->options;
 
436
            err = sendBuffer ((const BYTE *) szStr, 132);
 
437
            ERRCHECK;
 
438
        }
 
439
    }
 
440
 
 
441
    BYTE    *p = raster->rasterdata[COLORTYPE_COLOR] + 20;
 
442
    int     dwNumItems;
 
443
    int     dwSize;
 
444
 
 
445
    DWORD    dwTotalSize = raster->rastersize[COLORTYPE_COLOR];
 
446
    dwTotalSize -= 20;
 
447
    int     iPadCount = 0;
 
448
 
 
449
    i = 0;
 
450
    if (dwTotalSize % 4)
 
451
    {
 
452
        iPadCount = ((dwTotalSize / 4 + 1) * 4) - dwTotalSize;
 
453
    }
 
454
 
 
455
    dwSize = 16 + dwTotalSize + iPadCount;
 
456
    dwNumItems = 1;
 
457
    if (bLastStride)
 
458
    {
 
459
        dwNumItems = 3;
 
460
        m_bNotSent = true;
 
461
    }
 
462
    dwSize += (dwNumItems * 12);
 
463
    i = SendChunkHeader (szStr, dwSize, ZJT_BITMAP, dwNumItems);
 
464
    i += SendItem (szStr+i, ZJIT_UINT32, ZJI_PLANE, (kEnd == 5) ? m_iPlaneNumber+1 : 4);
 
465
    if (bLastStride)
 
466
    {
 
467
        i += SendItem (szStr+i, ZJIT_UINT32, ZJI_BITMAP_LINES, se->yd);
 
468
        i += SendItem (szStr+i, ZJIT_UINT32, ZJI_END_PLANE, bLastStride);
 
469
    }
 
470
    err = sendBuffer ((const BYTE *) szStr, i);
 
471
    ERRCHECK;
 
472
 
 
473
    err = sendBuffer ((const BYTE *) p, dwTotalSize);
 
474
    ERRCHECK;
 
475
    if (iPadCount != 0)
 
476
    {
 
477
        memset (szStr, 0, iPadCount);
 
478
        err = sendBuffer ((const BYTE *) szStr, iPadCount);
 
479
    }
 
480
 
 
481
    if (m_pJA->color_mode == 0)
 
482
    {
 
483
        m_iPlaneNumber++;
 
484
        if (m_iPlaneNumber == 4)
 
485
        {
 
486
            m_iPlaneNumber = 0;
 
487
        }
 
488
    }
 
489
    return err;
 
490
}
 
491