~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to packages/base/pasjpeg/jcmainct.pas

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2005-05-30 11:59:10 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050530115910-x5pbzm4qqta4i94h
Tags: 2.0.0-2
debian/fp-compiler.postinst.in: forgot to reapply the patch that
correctly creates the slave link to pc(1).  (Closes: #310907)

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
  my_main_controller = record
44
44
    pub : jpeg_c_main_controller; { public fields }
45
45
 
46
 
    cur_iMCU_row : JDIMENSION;  { number of current iMCU row }
47
 
    rowgroup_ctr : JDIMENSION;  { counts row groups received in iMCU row }
48
 
    suspended : boolean;                { remember if we suspended output }
49
 
    pass_mode : J_BUF_MODE;             { current operating mode }
 
46
    cur_iMCU_row : JDIMENSION;  { number of current iMCU row }
 
47
    rowgroup_ctr : JDIMENSION;  { counts row groups received in iMCU row }
 
48
    suspended : boolean;                { remember if we suspended output }
 
49
    pass_mode : J_BUF_MODE;             { current operating mode }
50
50
 
51
51
    { If using just a strip buffer, this points to the entire set of buffers
52
52
      (we allocate one for each component).  In the full-image case, this
93
93
  if (cinfo^.raw_data_in) then
94
94
    exit;
95
95
 
96
 
  main^.cur_iMCU_row := 0;      { initialize counters }
 
96
  main^.cur_iMCU_row := 0;      { initialize counters }
97
97
  main^.rowgroup_ctr := 0;
98
98
  main^.suspended := FALSE;
99
 
  main^.pass_mode := pass_mode; { save mode for use by process_data }
 
99
  main^.pass_mode := pass_mode; { save mode for use by process_data }
100
100
 
101
101
  case (pass_mode) of
102
102
  JBUF_PASS_THRU:
129
129
 
130
130
{METHODDEF}
131
131
procedure process_data_simple_main (cinfo : j_compress_ptr;
132
 
                                    input_buf : JSAMPARRAY;
 
132
                                    input_buf : JSAMPARRAY;
133
133
                                    var in_row_ctr : JDIMENSION;
134
134
                                    in_rows_avail : JDIMENSION);
135
135
var
145
145
                                     input_buf,
146
146
                                     in_row_ctr,
147
147
                                     in_rows_avail,
148
 
                                     JSAMPIMAGE(@main^.buffer),
 
148
                                     JSAMPIMAGE(@main^.buffer),
149
149
                                     main^.rowgroup_ctr,
150
 
                                     JDIMENSION(DCTSIZE));
 
150
                                     JDIMENSION(DCTSIZE));
151
151
 
152
152
    { If we don't have a full iMCU row buffered, return to application for
153
153
      more data.  Note that preprocessor will always pad to fill the iMCU row
166
166
 
167
167
      if (not main^.suspended) then
168
168
      begin
169
 
        Dec(in_row_ctr);
170
 
        main^.suspended := TRUE;
 
169
        Dec(in_row_ctr);
 
170
        main^.suspended := TRUE;
171
171
      end;
172
172
      exit;
173
173
    end;
192
192
 
193
193
{METHODDEF}
194
194
procedure process_data_buffer_main (cinfo : j_compress_ptr;
195
 
                                    input_buf : JSAMPARRAY;
 
195
                                    input_buf : JSAMPARRAY;
196
196
                                    var in_row_ctr : JDIMENSION;
197
 
                                    in_rows_avail : JDIMENSION);
 
197
                                    in_rows_avail : JDIMENSION);
198
198
var
199
199
  main : my_main_ptr;
200
200
  ci : int;
212
212
      compptr := cinfo^.comp_info;
213
213
      for ci := 0 to pred(cinfo^.num_components) do
214
214
      begin
215
 
        main^.buffer[ci] := cinfo^.mem^.access_virt_sarray
216
 
          (j_common_ptr (cinfo), main^.whole_image[ci],
217
 
           main^.cur_iMCU_row * (compptr^.v_samp_factor * DCTSIZE),
218
 
           JDIMENSION (compptr^.v_samp_factor * DCTSIZE), writing);
 
215
        main^.buffer[ci] := cinfo^.mem^.access_virt_sarray
 
216
          (j_common_ptr (cinfo), main^.whole_image[ci],
 
217
           main^.cur_iMCU_row * (compptr^.v_samp_factor * DCTSIZE),
 
218
           JDIMENSION (compptr^.v_samp_factor * DCTSIZE), writing);
219
219
        Inc(compptr);
220
220
      end;
221
221
      { In a read pass, pretend we just read some source data. }
222
222
      if (not writing) then
223
223
      begin
224
 
        Inc(in_row_ctr, cinfo^.max_v_samp_factor * DCTSIZE);
225
 
        main^.rowgroup_ctr := DCTSIZE;
 
224
        Inc(in_row_ctr, cinfo^.max_v_samp_factor * DCTSIZE);
 
225
        main^.rowgroup_ctr := DCTSIZE;
226
226
      end;
227
227
    end;
228
228
 
232
232
    begin
233
233
      cinfo^.prep^.pre_process_data (cinfo,
234
234
                                     input_buf, in_row_ctr, in_rows_avail,
235
 
                                     JSAMPIMAGE(@main^.buffer),
 
235
                                     JSAMPIMAGE(@main^.buffer),
236
236
                                     main^.rowgroup_ctr,
237
 
                                     JDIMENSION (DCTSIZE));
 
237
                                     JDIMENSION (DCTSIZE));
238
238
 
239
239
      { Return to application if we need more data to fill the iMCU row. }
240
240
      if (main^.rowgroup_ctr < DCTSIZE) then
241
 
        exit;
 
241
        exit;
242
242
    end;
243
243
 
244
244
    { Emit data, unless this is a sink-only pass. }
247
247
      if (not cinfo^.coef^.compress_data (cinfo,
248
248
                                          JSAMPIMAGE(@main^.buffer))) then
249
249
      begin
250
 
        { If compressor did not consume the whole row, then we must need to
251
 
          suspend processing and return to the application.  In this situation
252
 
          we pretend we didn't yet consume the last input row; otherwise, if
253
 
          it happened to be the last row of the image, the application would
254
 
          think we were done. }
 
250
        { If compressor did not consume the whole row, then we must need to
 
251
          suspend processing and return to the application.  In this situation
 
252
          we pretend we didn't yet consume the last input row; otherwise, if
 
253
          it happened to be the last row of the image, the application would
 
254
          think we were done. }
255
255
 
256
 
        if (not main^.suspended) then
 
256
        if (not main^.suspended) then
257
257
        begin
258
 
          Dec(in_row_ctr);
259
 
          main^.suspended := TRUE;
260
 
        end;
261
 
        exit;
 
258
          Dec(in_row_ctr);
 
259
          main^.suspended := TRUE;
 
260
        end;
 
261
        exit;
262
262
      end;
263
263
      { We did finish the row.  Undo our little suspension hack if a previous
264
264
        call suspended; then mark the main buffer empty. }
265
265
 
266
266
      if (main^.suspended) then
267
267
      begin
268
 
        Inc(in_row_ctr);
269
 
        main^.suspended := FALSE;
 
268
        Inc(in_row_ctr);
 
269
        main^.suspended := FALSE;
270
270
      end;
271
271
    end;
272
272
 
291
291
begin
292
292
  main := my_main_ptr(
293
293
    cinfo^.mem^.alloc_small (j_common_ptr(cinfo), JPOOL_IMAGE,
294
 
                                SIZEOF(my_main_controller)) );
 
294
                                SIZEOF(my_main_controller)) );
295
295
  cinfo^.main := jpeg_c_main_controller_ptr(main);
296
296
  main^.pub.start_pass := start_pass_main;
297
297
 
311
311
    for ci := 0 to pred(cinfo^.num_components) do
312
312
    begin
313
313
      main^.whole_image[ci] := cinfo^.mem^.request_virt_sarray
314
 
        (j_common_ptr(cinfo), JPOOL_IMAGE, FALSE,
315
 
         compptr^.width_in_blocks * DCTSIZE,
316
 
         JDIMENSION (jround_up( long (compptr^.height_in_blocks),
317
 
                                long (compptr^.v_samp_factor)) * DCTSIZE),
318
 
         JDIMENSION (compptr^.v_samp_factor * DCTSIZE));
 
314
        (j_common_ptr(cinfo), JPOOL_IMAGE, FALSE,
 
315
         compptr^.width_in_blocks * DCTSIZE,
 
316
         JDIMENSION (jround_up( long (compptr^.height_in_blocks),
 
317
                                long (compptr^.v_samp_factor)) * DCTSIZE),
 
318
         JDIMENSION (compptr^.v_samp_factor * DCTSIZE));
319
319
      Inc(compptr);
320
320
    end;
321
321
{$else}
332
332
    for ci := 0 to pred(cinfo^.num_components) do
333
333
    begin
334
334
      main^.buffer[ci] := cinfo^.mem^.alloc_sarray
335
 
        (j_common_ptr(cinfo), JPOOL_IMAGE,
336
 
         compptr^.width_in_blocks * DCTSIZE,
337
 
         JDIMENSION (compptr^.v_samp_factor * DCTSIZE));
 
335
        (j_common_ptr(cinfo), JPOOL_IMAGE,
 
336
         compptr^.width_in_blocks * DCTSIZE,
 
337
         JDIMENSION (compptr^.v_samp_factor * DCTSIZE));
338
338
      Inc(compptr);
339
339
    end;
340
340
  end;