Coverage Report

Created: 2026-04-01 07:24

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/LibRaw/src/metadata/mediumformat.cpp
Line
Count
Source
1
/* -*- C++ -*-
2
 * Copyright 2019-2025 LibRaw LLC (info@libraw.org)
3
 *
4
 LibRaw uses code from dcraw.c -- Dave Coffin's raw photo decoder,
5
 dcraw.c is copyright 1997-2018 by Dave Coffin, dcoffin a cybercom o net.
6
 LibRaw do not use RESTRICTED code from dcraw.c
7
8
 LibRaw is free software; you can redistribute it and/or modify
9
 it under the terms of the one of two licenses as you choose:
10
11
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
12
   (See file LICENSE.LGPL provided in LibRaw distribution archive for details).
13
14
2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
15
   (See file LICENSE.CDDL provided in LibRaw distribution archive for details).
16
17
 */
18
19
#include "../../internal/dcraw_defs.h"
20
21
void LibRaw::parse_phase_one(INT64 base)
22
2.91k
{
23
2.91k
  unsigned entries, tag, type, len, data, i, c;
24
2.91k
  INT64 save;
25
2.91k
  float romm_cam[3][3];
26
2.91k
  char *cp;
27
28
2.91k
  memset(&ph1, 0, sizeof ph1);
29
2.91k
  fseek(ifp, base, SEEK_SET);
30
2.91k
  order = get4() & 0xffff;
31
2.91k
  if (get4() >> 8 != 0x526177)
32
498
    return; /* "Raw" */
33
2.41k
  unsigned offset = get4();
34
2.41k
  if (offset == 0xbad0bad)
35
0
    return;
36
2.41k
  fseek(ifp, offset + base, SEEK_SET);
37
2.41k
  entries = get4();
38
2.41k
  if (entries > 8192)
39
46
    return; // too much??
40
2.37k
  get4();
41
2.37k
  INT64 fsize = ifp->size();
42
43
3.68M
  while (entries--)
44
3.68M
  {
45
3.68M
    tag = get4();
46
3.68M
    type = get4();
47
3.68M
    len = get4();
48
3.68M
  if (feof(ifp))
49
2.01k
    break;
50
3.68M
    data = get4();
51
3.68M
    save = ftell(ifp);
52
3.68M
  bool do_seek = (tag < 0x0108 || tag > 0x0110); // to make it single rule, not copy-paste
53
3.68M
  if(do_seek)
54
3.64M
    fseek(ifp, base + data, SEEK_SET);
55
56
3.68M
  INT64 savepos = ftell(ifp);
57
3.68M
  if (len > 8 && savepos + len > 2 * fsize)
58
2.78M
    {
59
2.78M
      fseek(ifp, save, SEEK_SET); // Recover tiff-read position!!
60
2.78M
      continue;
61
2.78M
    }
62
63
898k
    switch (tag)
64
898k
    {
65
66
7.58k
    case 0x0100:
67
7.58k
      flip = "0653"[data & 3] - '0';
68
7.58k
      break;
69
252
    case 0x0102:
70
252
      stmread(imgdata.shootinginfo.BodySerial, len, ifp);
71
252
      if ((imgdata.shootinginfo.BodySerial[0] == 0x4c) && (imgdata.shootinginfo.BodySerial[1] == 0x49))
72
6
      {
73
6
        unique_id =
74
6
            (((imgdata.shootinginfo.BodySerial[0] & 0x3f) << 5) | (imgdata.shootinginfo.BodySerial[2] & 0x3f)) - 0x41;
75
6
      }
76
246
      else
77
246
      {
78
246
        unique_id =
79
246
            (((imgdata.shootinginfo.BodySerial[0] & 0x3f) << 5) | (imgdata.shootinginfo.BodySerial[1] & 0x3f)) - 0x41;
80
246
      }
81
252
      setPhaseOneFeatures(unique_id);
82
252
      break;
83
36
    case 0x0106:
84
360
      for (i = 0; i < 9; i++)
85
324
        imgdata.color.P1_color[0].romm_cam[i] = ((float *)romm_cam)[i] =
86
324
            (float)getreal(LIBRAW_EXIFTAG_TYPE_FLOAT);
87
36
      romm_coeff(romm_cam);
88
36
      break;
89
26
    case 0x0107:
90
78
      FORC3 cam_mul[c] = (float)getreal(LIBRAW_EXIFTAG_TYPE_FLOAT);
91
26
      break;
92
264
    case 0x0108:
93
264
      raw_width = data;
94
264
      break;
95
2.43k
    case 0x0109:
96
2.43k
      raw_height = data;
97
2.43k
      break;
98
88
    case 0x010a:
99
88
      left_margin = data;
100
88
      break;
101
6
    case 0x010b:
102
6
      top_margin = data;
103
6
      break;
104
6
    case 0x010c:
105
6
      width = data;
106
6
      break;
107
2
    case 0x010d:
108
2
      height = data;
109
2
      break;
110
1.58k
    case 0x010e:
111
1.58k
      ph1.format = data;
112
1.58k
      break;
113
958
    case 0x010f:
114
958
      data_offset = data + base;
115
958
    data_size = len;
116
958
      break;
117
682
    case 0x0110:
118
682
      meta_offset = data + base;
119
682
      meta_length = len;
120
682
      break;
121
84
    case 0x0112:
122
84
      ph1.key_off = int(save - 4);
123
84
      break;
124
56
    case 0x0203:
125
56
      stmread(imPhaseOne.Software, len, ifp);
126
94
    case 0x0204:
127
94
      stmread(imPhaseOne.SystemType, len, ifp);
128
348
    case 0x0210:
129
348
      ph1.tag_210 = int_to_float(data);
130
348
      imCommon.SensorTemperature = ph1.tag_210;
131
348
      break;
132
110
    case 0x0211:
133
110
      imCommon.SensorTemperature2 = int_to_float(data);
134
110
      break;
135
20
    case 0x021a:
136
20
      ph1.tag_21a = data;
137
20
      break;
138
1.07k
    case 0x021c:
139
1.07k
      strip_offset = data + base;
140
1.07k
      break;
141
94
    case 0x021d:
142
94
      ph1.t_black = data;
143
94
      break;
144
4
    case 0x0222:
145
4
      ph1.split_col = data;
146
4
      break;
147
156
    case 0x0223:
148
156
      ph1.black_col = int(data + base);
149
156
      break;
150
150
    case 0x0224:
151
150
      ph1.split_row = data;
152
150
      break;
153
58
    case 0x0225:
154
58
      ph1.black_row = int(data + base);
155
58
      break;
156
6
    case 0x0226:
157
60
      for (i = 0; i < 9; i++)
158
54
        imgdata.color.P1_color[1].romm_cam[i] = (float)getreal(LIBRAW_EXIFTAG_TYPE_FLOAT);
159
6
      break;
160
298
    case 0x0301:
161
298
      model[63] = 0;
162
298
      fread(imPhaseOne.FirmwareString, 1, 255, ifp);
163
298
      imPhaseOne.FirmwareString[255] = 0;
164
298
      memcpy(model, imPhaseOne.FirmwareString, 63);
165
298
    model[63] = 0;
166
298
      if ((cp = strstr(model, " camera")))
167
0
        *cp = 0;
168
298
      else if ((cp = strchr(model, ',')))
169
20
        *cp = 0;
170
      /* minus and the letter after it are not always present
171
        if present, last letter means:
172
          C : Contax 645AF
173
          H : Hasselblad H1 / H2
174
          M : Mamiya
175
          V : Hasselblad 555ELD / 553ELX / 503CW / 501CM; not included below
176
        because of adapter conflicts (Mamiya RZ body) if not present, Phase One
177
        645 AF, Mamiya 645AFD Series, or anything
178
       */
179
298
      strcpy(imPhaseOne.SystemModel, model);
180
298
      if ((cp = strchr(model, '-')))
181
48
      {
182
48
        if (cp[1] == 'C')
183
0
        {
184
0
          strcpy(ilm.body, "Contax 645AF");
185
0
          ilm.CameraMount = LIBRAW_MOUNT_Contax645;
186
0
          ilm.CameraFormat = LIBRAW_FORMAT_645;
187
0
        }
188
48
        else if (cp[1] == 'M')
189
6
        {
190
6
          strcpy(ilm.body, "Mamiya 645");
191
6
          ilm.CameraMount = LIBRAW_MOUNT_Mamiya645;
192
6
          ilm.CameraFormat = LIBRAW_FORMAT_645;
193
6
        }
194
42
        else if (cp[1] == 'H')
195
6
        {
196
6
          strcpy(ilm.body, "Hasselblad H1/H2");
197
6
          ilm.CameraMount = LIBRAW_MOUNT_Hasselblad_H;
198
6
          ilm.CameraFormat = LIBRAW_FORMAT_645;
199
6
        }
200
48
        *cp = 0;
201
48
      }
202
1.06k
    case 0x0401:
203
1.06k
      if (tagtypeIs(LIBRAW_EXIFTAG_TYPE_LONG))
204
22
        ilm.CurAp = libraw_powf64l(2.0f, (int_to_float(data) / 2.0f));
205
1.04k
      else
206
1.04k
        ilm.CurAp = libraw_powf64l(2.0f, getrealf(type) / 2.0f);
207
1.06k
      break;
208
284
    case 0x0403:
209
284
      if (tagtypeIs(LIBRAW_EXIFTAG_TYPE_LONG))
210
4
        ilm.CurFocal = int_to_float(data);
211
280
      else
212
280
        ilm.CurFocal = (float)getreal(type);
213
284
      break;
214
3.17k
    case 0x0410:
215
3.17k
      stmread(ilm.body, len, ifp);
216
3.17k
      if (((unsigned char)ilm.body[0]) == 0xff)
217
222
        ilm.body[0] = 0;
218
3.17k
      break;
219
1.02k
    case 0x0412:
220
1.02k
      stmread(ilm.Lens, len, ifp);
221
1.02k
      if (((unsigned char)ilm.Lens[0]) == 0xff)
222
200
        ilm.Lens[0] = 0;
223
1.02k
      break;
224
66
    case 0x0414:
225
66
      if (tagtypeIs(LIBRAW_EXIFTAG_TYPE_LONG))
226
8
      {
227
8
        ilm.MaxAp4CurFocal = libraw_powf64l(2.0f, (int_to_float(data) / 2.0f));
228
8
      }
229
58
      else
230
58
      {
231
58
        ilm.MaxAp4CurFocal = libraw_powf64l(2.0f, getrealf(type) / 2.0f);
232
58
      }
233
66
      break;
234
198
    case 0x0415:
235
198
      if (tagtypeIs(LIBRAW_EXIFTAG_TYPE_LONG))
236
10
      {
237
10
        ilm.MinAp4CurFocal = libraw_powf64l(2.0f, (int_to_float(data) / 2.0f));
238
10
      }
239
188
      else
240
188
      {
241
188
        ilm.MinAp4CurFocal = libraw_powf64l(2.0f, getrealf(type) / 2.0f);
242
188
      }
243
198
      break;
244
52
    case 0x0416:
245
52
      if (tagtypeIs(LIBRAW_EXIFTAG_TYPE_LONG))
246
6
      {
247
6
        ilm.MinFocal = int_to_float(data);
248
6
      }
249
46
      else
250
46
      {
251
46
        ilm.MinFocal = (float)getreal(type);
252
46
      }
253
52
      if (ilm.MinFocal > 1000.0f)
254
14
      {
255
14
        ilm.MinFocal = 0.0f;
256
14
      }
257
52
      break;
258
62
    case 0x0417:
259
62
      if (tagtypeIs(LIBRAW_EXIFTAG_TYPE_LONG))
260
6
      {
261
6
        ilm.MaxFocal = int_to_float(data);
262
6
      }
263
56
      else
264
56
      {
265
56
        ilm.MaxFocal = (float)getreal(type);
266
56
      }
267
62
      break;
268
898k
    }
269
898k
    if (do_seek)
270
892k
      fseek(ifp, save, SEEK_SET);
271
898k
  }
272
273
2.37k
  if (!ilm.body[0] && !imgdata.shootinginfo.BodySerial[0])
274
586
  {
275
586
    fseek(ifp, meta_offset, SEEK_SET);
276
586
    order = get2();
277
586
    fseek(ifp, 6, SEEK_CUR);
278
586
    fseek(ifp, meta_offset + get4(), SEEK_SET);
279
586
    entries = get4();
280
586
    if (entries > 8192)
281
250
      return; // too much??
282
336
    get4();
283
200k
    while (entries--)
284
200k
    {
285
200k
      tag = get4();
286
200k
      len = get4();
287
200k
    if (feof(ifp))
288
250
      break;
289
200k
      data = get4();
290
200k
      save = ftell(ifp);
291
200k
      fseek(ifp, meta_offset + data, SEEK_SET);
292
293
200k
    INT64 savepos = ftell(ifp);
294
200k
      if (len > 8 && savepos + len > 2 * fsize)
295
143k
      {
296
143k
        fseek(ifp, save, SEEK_SET); // Recover tiff-read position!!
297
143k
        continue;
298
143k
      }
299
300
56.6k
      if (tag == 0x0407)
301
42
      {
302
42
        stmread(imgdata.shootinginfo.BodySerial, len, ifp);
303
42
        if ((imgdata.shootinginfo.BodySerial[0] == 0x4c) &&
304
8
            (imgdata.shootinginfo.BodySerial[1] == 0x49))
305
2
        {
306
2
          unique_id = (((imgdata.shootinginfo.BodySerial[0] & 0x3f) << 5) |
307
2
                       (imgdata.shootinginfo.BodySerial[2] & 0x3f)) -
308
2
                      0x41;
309
2
        }
310
40
        else
311
40
        {
312
40
          unique_id = (((imgdata.shootinginfo.BodySerial[0] & 0x3f) << 5) |
313
40
                       (imgdata.shootinginfo.BodySerial[1] & 0x3f)) -
314
40
                      0x41;
315
40
        }
316
42
        setPhaseOneFeatures(unique_id);
317
42
      }
318
56.6k
      fseek(ifp, save, SEEK_SET);
319
56.6k
    }
320
336
  }
321
322
2.12k
  if ((ilm.MaxAp4CurFocal > 0.7f) &&
323
14
      (ilm.MinAp4CurFocal > 0.7f)) {
324
4
    float MinAp4CurFocal = MAX(ilm.MaxAp4CurFocal,ilm.MinAp4CurFocal);
325
4
    ilm.MaxAp4CurFocal   = MIN(ilm.MaxAp4CurFocal,ilm.MinAp4CurFocal);
326
4
    ilm.MinAp4CurFocal = MinAp4CurFocal;
327
4
  }
328
329
2.12k
  if (ph1.format == 6)
330
916
    load_raw = &LibRaw::phase_one_load_raw_s;
331
1.20k
  else
332
1.20k
    load_raw = ph1.format < 3 ? &LibRaw::phase_one_load_raw : &LibRaw::phase_one_load_raw_c;
333
2.12k
  maximum = 0xffff; // Always scaled to 16bit?
334
2.12k
  strcpy(make, "Phase One");
335
2.12k
  if (model[0])
336
136
    return;
337
1.98k
  switch (raw_height)
338
1.98k
  {
339
0
  case 2060:
340
0
    strcpy(model, "LightPhase");
341
0
    break;
342
0
  case 2682:
343
0
    strcpy(model, "H 10");
344
0
    break;
345
0
  case 4128:
346
0
    strcpy(model, "H 20");
347
0
    break;
348
0
  case 5488:
349
0
    strcpy(model, "H 25");
350
0
    break;
351
1.98k
  }
352
1.98k
}
353
354
void LibRaw::parse_mos(INT64 offset)
355
6.05k
{
356
6.05k
  char data[40];
357
6.05k
  int i, c, neut[4], planes = 0, frot = 0;
358
6.05k
  INT64 from;
359
6.05k
  unsigned skip;
360
6.05k
  static const char *mod[] = {
361
      /* DM22, DM28, DM40, DM56 are somewhere here too */
362
6.05k
      "",             //  0
363
6.05k
      "DCB2",         //  1
364
6.05k
      "Volare",       //  2
365
6.05k
      "Cantare",      //  3
366
6.05k
      "CMost",        //  4
367
6.05k
      "Valeo 6",      //  5
368
6.05k
      "Valeo 11",     //  6
369
6.05k
      "Valeo 22",     //  7
370
6.05k
      "Valeo 11p",    //  8
371
6.05k
      "Valeo 17",     //  9
372
6.05k
      "",             // 10
373
6.05k
      "Aptus 17",     // 11
374
6.05k
      "Aptus 22",     // 12
375
6.05k
      "Aptus 75",     // 13
376
6.05k
      "Aptus 65",     // 14
377
6.05k
      "Aptus 54S",    // 15
378
6.05k
      "Aptus 65S",    // 16
379
6.05k
      "Aptus 75S",    // 17
380
6.05k
      "AFi 5",        // 18
381
6.05k
      "AFi 6",        // 19
382
6.05k
      "AFi 7",        // 20
383
6.05k
      "AFi-II 7",     // 21
384
6.05k
      "Aptus-II 7",   // 22 (same CMs as Mamiya DM33)
385
6.05k
      "",             // 23
386
6.05k
      "Aptus-II 6",   // 24 (same CMs as Mamiya DM28)
387
6.05k
      "AFi-II 10",    // 25
388
6.05k
      "",             // 26
389
6.05k
      "Aptus-II 10",  // 27 (same CMs as Mamiya DM56)
390
6.05k
      "Aptus-II 5",   // 28 (same CMs as Mamiya DM22)
391
6.05k
      "",             // 29
392
6.05k
      "DM33",         // 30, make is Mamiya
393
6.05k
      "",             // 31
394
6.05k
      "",             // 32
395
6.05k
      "Aptus-II 10R", // 33
396
6.05k
      "Aptus-II 8",   // 34 (same CMs as Mamiya DM40)
397
6.05k
      "",             // 35
398
6.05k
      "Aptus-II 12",  // 36
399
6.05k
      "",             // 37
400
6.05k
      "AFi-II 12"     // 38
401
6.05k
  };
402
6.05k
  float romm_cam[3][3];
403
404
6.05k
  fseek(ifp, offset, SEEK_SET);
405
9.09k
  while (!feof(ifp))
406
8.95k
  {
407
8.95k
    if (get4() != 0x504b5453)
408
5.92k
      break;
409
3.03k
    get4();
410
3.03k
    memset(data,0,sizeof(data));
411
3.03k
    fread(data, 1, 40, ifp);
412
3.03k
    data[39] = 0;
413
3.03k
    skip = get4();
414
3.03k
    from = ftell(ifp);
415
416
3.03k
    if (!strcmp(data, "CameraObj_camera_type"))
417
464
    {
418
464
      stmread(ilm.body, (unsigned)skip, ifp);
419
464
      if (ilm.body[0])
420
388
      {
421
388
        if (!strncmp(ilm.body, "Mamiya R", 8))
422
34
        {
423
34
          ilm.CameraMount = LIBRAW_MOUNT_Mamiya67;
424
34
          ilm.CameraFormat = LIBRAW_FORMAT_67;
425
34
        }
426
354
        else if (!strncmp(ilm.body, "Hasselblad 5", 12))
427
36
        {
428
36
          ilm.CameraFormat = LIBRAW_FORMAT_66;
429
36
          ilm.CameraMount = LIBRAW_MOUNT_Hasselblad_V;
430
36
        }
431
318
        else if (!strncmp(ilm.body, "Hasselblad H", 12))
432
24
        {
433
24
          ilm.CameraMount = LIBRAW_MOUNT_Hasselblad_H;
434
24
          ilm.CameraFormat = LIBRAW_FORMAT_645;
435
24
        }
436
294
        else if (!strncmp(ilm.body, "Mamiya 6", 8) ||
437
252
                 !strncmp(ilm.body, "Phase One 6", 11))
438
114
        {
439
114
          ilm.CameraMount = LIBRAW_MOUNT_Mamiya645;
440
114
          ilm.CameraFormat = LIBRAW_FORMAT_645;
441
114
        }
442
180
        else if (!strncmp(ilm.body, "Large F", 7))
443
54
        {
444
54
          ilm.CameraMount = LIBRAW_MOUNT_LF;
445
54
          ilm.CameraFormat = LIBRAW_FORMAT_LF;
446
54
        }
447
126
        else if (!strncmp(model, "Leaf AFi", 8))
448
0
        {
449
0
          ilm.CameraMount = LIBRAW_MOUNT_Rollei_bayonet;
450
0
          ilm.CameraFormat = LIBRAW_FORMAT_66;
451
0
        }
452
388
      }
453
464
    }
454
3.03k
    if (!strcmp(data, "back_serial_number"))
455
238
    {
456
238
      char buffer[sizeof(imgdata.shootinginfo.BodySerial)];
457
238
      char *words[4] = {0, 0, 0, 0};
458
238
      stmread(buffer, (unsigned)skip, ifp);
459
      /*nwords = */
460
238
          getwords(buffer, words, 4, sizeof(imgdata.shootinginfo.BodySerial));
461
238
    if(words[0])
462
232
    strcpy(imgdata.shootinginfo.BodySerial, words[0]);
463
238
    }
464
3.03k
    if (!strcmp(data, "CaptProf_serial_number"))
465
326
    {
466
326
      char buffer[sizeof(imgdata.shootinginfo.InternalBodySerial)];
467
326
      char *words[4] = {0, 0, 0, 0};
468
326
      stmread(buffer, (unsigned)skip, ifp);
469
326
      getwords(buffer, words, 4, sizeof(imgdata.shootinginfo.InternalBodySerial));
470
326
    if(words[0])
471
138
    strcpy(imgdata.shootinginfo.InternalBodySerial, words[0]);
472
326
    }
473
474
3.03k
    if (!strcmp(data, "JPEG_preview_data"))
475
0
    {
476
0
      thumb_offset = from;
477
0
      thumb_length = skip;
478
0
    }
479
3.03k
    if (!strcmp(data, "icc_camera_profile"))
480
6
    {
481
6
      profile_offset = from;
482
6
      profile_length = skip;
483
6
    }
484
3.03k
    if (!strcmp(data, "ShootObj_back_type"))
485
34
    {
486
34
      fscanf(ifp, "%d", &i);
487
34
      if ((unsigned)i < sizeof mod / sizeof(*mod))
488
34
      {
489
34
        strcpy(model, mod[i]);
490
34
        if (!strncmp(model, "AFi", 3))
491
0
        {
492
0
          ilm.CameraMount = LIBRAW_MOUNT_Rollei_bayonet;
493
0
          ilm.CameraFormat = LIBRAW_FORMAT_66;
494
0
        }
495
34
        ilm.CamID = i;
496
34
      }
497
34
    }
498
3.03k
    if (!strcmp(data, "icc_camera_to_tone_matrix"))
499
0
    {
500
0
      for (i = 0; i < 9; i++)
501
0
        ((float *)romm_cam)[i] = int_to_float(get4());
502
0
      romm_coeff(romm_cam);
503
0
    }
504
3.03k
    if (!strcmp(data, "CaptProf_color_matrix"))
505
122
    {
506
1.22k
      for (i = 0; i < 9; i++)
507
1.09k
        fscanf(ifp, "%f", (float *)romm_cam + i);
508
122
      romm_coeff(romm_cam);
509
122
    }
510
3.03k
    if (!strcmp(data, "CaptProf_number_of_planes"))
511
0
      fscanf(ifp, "%d", &planes);
512
3.03k
    if (!strcmp(data, "CaptProf_raw_data_rotation"))
513
0
      fscanf(ifp, "%d", &flip);
514
3.03k
    if (!strcmp(data, "CaptProf_mosaic_pattern"))
515
998
      FORC4
516
3.99k
      {
517
3.99k
        fscanf(ifp, "%d", &i);
518
3.99k
        if (i == 1)
519
228
          frot = c ^ (c >> 1); // 0123 -> 0132
520
3.99k
      }
521
3.03k
    if (!strcmp(data, "ImgProf_rotation_angle"))
522
74
    {
523
74
      fscanf(ifp, "%d", &i);
524
74
      flip = i - flip;
525
74
    }
526
3.03k
    if (!strcmp(data, "NeutObj_neutrals") && !cam_mul[0])
527
0
    {
528
0
      FORC4 fscanf(ifp, "%d", neut + c);
529
0
      FORC3
530
0
      if (neut[c + 1])
531
0
        cam_mul[c] = (float)neut[0] / neut[c + 1];
532
0
    }
533
3.03k
    if (!strcmp(data, "Rows_data"))
534
0
      load_flags = get4();
535
3.03k
    parse_mos(from);
536
3.03k
    fseek(ifp, skip + from, SEEK_SET);
537
3.03k
  }
538
6.05k
  if (planes)
539
0
    filters = (planes == 1) * 0x01010101U *
540
0
              (uchar) "\x94\x61\x16\x49"[(flip / 90 + frot) & 3];
541
6.05k
}