~ubuntu-branches/ubuntu/trusty/gavl/trusty

« back to all changes in this revision

Viewing changes to gavl/c/_rgb_rgb_c.c

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2007-04-16 12:53:08 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070416125308-k8gdo9sofz72gjkf
Tags: 0.2.5-1
* New upstream release
* Adapted fpic.patch to the new version
* Fixed broken watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
  dst[2]=RGB_8_TO_FLOAT(src[2]);
37
37
 
38
38
#define COPY_48_TO_24 \
39
 
  dst[0]=RGB_16_TO_8(src[0]);\
40
 
  dst[1]=RGB_16_TO_8(src[1]);\
41
 
  dst[2]=RGB_16_TO_8(src[2]);
 
39
  RGB_16_TO_8(src[0], dst[0]);\
 
40
  RGB_16_TO_8(src[1], dst[1]);\
 
41
  RGB_16_TO_8(src[2], dst[2]);
42
42
 
43
43
#define COPY_48_TO_48 \
44
44
  dst[0]=src[0];\
52
52
  dst[2]=RGB_16_TO_FLOAT(src[2]);
53
53
 
54
54
#define COPY_FLOAT_TO_24 \
55
 
  dst[0]=RGB_FLOAT_TO_8(src[0]);\
56
 
  dst[1]=RGB_FLOAT_TO_8(src[1]);\
57
 
  dst[2]=RGB_FLOAT_TO_8(src[2]);
 
55
  RGB_FLOAT_TO_8(src[0], dst[0]);\
 
56
  RGB_FLOAT_TO_8(src[1], dst[1]);\
 
57
  RGB_FLOAT_TO_8(src[2], dst[2]);
58
58
 
59
59
#define COPY_FLOAT_TO_48 \
60
 
  dst[0]=RGB_FLOAT_TO_16(src[0]);\
61
 
  dst[1]=RGB_FLOAT_TO_16(src[1]);\
62
 
  dst[2]=RGB_FLOAT_TO_16(src[2]);
 
60
  RGB_FLOAT_TO_16(src[0], dst[0]);\
 
61
  RGB_FLOAT_TO_16(src[1], dst[1]);\
 
62
  RGB_FLOAT_TO_16(src[2], dst[2]);
63
63
 
64
64
#define COPY_FLOAT_TO_FLOAT                        \
65
65
  dst[0]=src[0];                                   \
79
79
  dst[0]=RGB_8_TO_FLOAT(src[2]);
80
80
 
81
81
#define SWAP_48_TO_24 \
82
 
  dst[2]=RGB_16_TO_8(src[0]);\
83
 
  dst[1]=RGB_16_TO_8(src[1]);\
84
 
  dst[0]=RGB_16_TO_8(src[2]);
 
82
  RGB_16_TO_8(src[0], dst[2]);\
 
83
  RGB_16_TO_8(src[1], dst[1]);\
 
84
  RGB_16_TO_8(src[2], dst[0]);
85
85
 
86
86
#define SWAP_48_TO_FLOAT \
87
 
  dst[2]=RGB_16_TO_FLOAT(src[0]);\
88
 
  dst[1]=RGB_16_TO_FLOAT(src[1]);\
89
 
  dst[0]=RGB_16_TO_FLOAT(src[2]);
 
87
  RGB_16_TO_FLOAT(src[0], dst[2]);\
 
88
  RGB_16_TO_FLOAT(src[1], dst[1]);\
 
89
  RGB_16_TO_FLOAT(src[2], dst[0]);
90
90
 
91
91
#define SWAP_FLOAT_TO_24 \
92
 
  dst[2]=RGB_FLOAT_TO_8(src[0]);\
93
 
  dst[1]=RGB_FLOAT_TO_8(src[1]);\
94
 
  dst[0]=RGB_FLOAT_TO_8(src[2]);
 
92
  RGB_FLOAT_TO_8(src[0], dst[2]);\
 
93
  RGB_FLOAT_TO_8(src[1], dst[1]);\
 
94
  RGB_FLOAT_TO_8(src[2], dst[0]);
95
95
 
96
96
/*
97
97
 *  Needs the following macros:
106
106
 *  INIT:        Variable declarations and initialization (can be empty)
107
107
 */
108
108
 
 
109
#ifndef HQ
 
110
 
109
111
/* swap_rgb_24_c */
110
112
 
111
113
#define IN_TYPE  uint8_t
463
465
 
464
466
#include "../csp_packed_packed.h"
465
467
 
 
468
#endif // !HQ
 
469
 
466
470
/* rgb_48_to_24_c */
467
471
 
468
472
#define IN_TYPE  uint16_t
471
475
#define OUT_ADVANCE 3
472
476
#define NUM_PIXELS  1
473
477
#define FUNC_NAME rgb_48_to_24_c
 
478
 
474
479
#define CONVERT \
475
480
  COPY_48_TO_24
 
481
#ifdef HQ
 
482
#define INIT int32_t round_tmp;
 
483
#endif
476
484
 
477
485
#include "../csp_packed_packed.h"
478
486
 
487
495
#define CONVERT \
488
496
  COPY_48_TO_24
489
497
 
 
498
#ifdef HQ
 
499
#define INIT int32_t round_tmp;
 
500
#endif
 
501
 
490
502
#include "../csp_packed_packed.h"
491
503
 
 
504
#ifndef HQ
 
505
 
492
506
/* rgb_48_to_float_c */
493
507
 
494
508
#define IN_TYPE  uint16_t
502
516
 
503
517
#include "../csp_packed_packed.h"
504
518
 
 
519
#endif // !HQ
 
520
 
505
521
/* rgb_float_to_15_c */
506
522
 
507
523
#define IN_TYPE  float
514
530
#define INIT uint8_t r_tmp, g_tmp, b_tmp;
515
531
 
516
532
#define CONVERT                                 \
517
 
  r_tmp = RGB_FLOAT_TO_8(src[0]);               \
518
 
  g_tmp = RGB_FLOAT_TO_8(src[1]);               \
519
 
  b_tmp = RGB_FLOAT_TO_8(src[2]);               \
 
533
  RGB_FLOAT_TO_8(src[0], r_tmp);               \
 
534
  RGB_FLOAT_TO_8(src[1], g_tmp);               \
 
535
  RGB_FLOAT_TO_8(src[2], b_tmp);               \
520
536
  PACK_8_TO_RGB15(r_tmp, g_tmp, b_tmp, *dst)
521
537
 
522
538
#include "../csp_packed_packed.h"
533
549
#define INIT uint8_t r_tmp, g_tmp, b_tmp;
534
550
 
535
551
#define CONVERT                                 \
536
 
  r_tmp = RGB_FLOAT_TO_8(src[0]);               \
537
 
  g_tmp = RGB_FLOAT_TO_8(src[1]);               \
538
 
  b_tmp = RGB_FLOAT_TO_8(src[2]);               \
 
552
  RGB_FLOAT_TO_8(src[0], r_tmp);               \
 
553
  RGB_FLOAT_TO_8(src[1], g_tmp);               \
 
554
  RGB_FLOAT_TO_8(src[2], b_tmp);               \
539
555
  PACK_8_TO_RGB16(r_tmp, g_tmp, b_tmp, *dst)
540
556
 
541
557
#include "../csp_packed_packed.h"
579
595
 
580
596
#include "../csp_packed_packed.h"
581
597
 
 
598
#ifndef HQ // !HQ
582
599
 
583
600
/* rgb_15_to_16_swap_c */
584
601
 
852
869
 
853
870
#include "../csp_packed_packed.h"
854
871
 
 
872
 
855
873
/* rgb_48_to_15_swap_c */
856
874
 
857
875
#define IN_TYPE  uint16_t
862
880
#define FUNC_NAME rgb_48_to_15_swap_c
863
881
#define CONVERT \
864
882
  PACK_16_TO_BGR15(src[0],src[1],src[2],*dst)
 
883
 
865
884
#include "../csp_packed_packed.h"
866
885
 
867
886
/* rgb_48_to_16_swap_c */
874
893
#define FUNC_NAME rgb_48_to_16_swap_c
875
894
#define CONVERT \
876
895
  PACK_16_TO_BGR16(src[0],src[1],src[2],*dst)
 
896
 
877
897
#include "../csp_packed_packed.h"
878
898
 
 
899
#endif // !HQ
 
900
 
879
901
/* rgb_48_to_24_swap_c */
880
902
 
881
903
#define IN_TYPE  uint16_t
886
908
#define FUNC_NAME rgb_48_to_24_swap_c
887
909
#define CONVERT \
888
910
  SWAP_48_TO_24
 
911
 
 
912
#ifdef HQ
 
913
#define INIT int32_t round_tmp;
 
914
#endif
 
915
 
889
916
#include "../csp_packed_packed.h"
890
917
 
891
918
/* rgb_48_to_32_swap_c */
898
925
#define FUNC_NAME rgb_48_to_32_swap_c
899
926
#define CONVERT \
900
927
  SWAP_48_TO_24
 
928
#ifdef HQ
 
929
#define INIT int32_t round_tmp;
 
930
#endif
 
931
 
901
932
#include "../csp_packed_packed.h"
902
933
 
 
934
 
903
935
/* rgb_float_to_15_swap_c */
904
936
 
905
937
#define IN_TYPE  float
912
944
#define INIT uint8_t r_tmp, g_tmp, b_tmp;
913
945
 
914
946
#define CONVERT                                 \
915
 
  r_tmp = RGB_FLOAT_TO_8(src[0]);               \
916
 
  g_tmp = RGB_FLOAT_TO_8(src[1]);               \
917
 
  b_tmp = RGB_FLOAT_TO_8(src[2]);               \
 
947
  RGB_FLOAT_TO_8(src[0], r_tmp);               \
 
948
  RGB_FLOAT_TO_8(src[1], g_tmp);               \
 
949
  RGB_FLOAT_TO_8(src[2], b_tmp);               \
918
950
  PACK_8_TO_BGR15(r_tmp, g_tmp, b_tmp, *dst)
919
951
 
920
952
#include "../csp_packed_packed.h"
931
963
#define INIT uint8_t r_tmp, g_tmp, b_tmp;
932
964
 
933
965
#define CONVERT                                 \
934
 
  r_tmp = RGB_FLOAT_TO_8(src[0]);               \
935
 
  g_tmp = RGB_FLOAT_TO_8(src[1]);               \
936
 
  b_tmp = RGB_FLOAT_TO_8(src[2]);               \
 
966
  RGB_FLOAT_TO_8(src[0], r_tmp);               \
 
967
  RGB_FLOAT_TO_8(src[1], g_tmp);               \
 
968
  RGB_FLOAT_TO_8(src[2], b_tmp);               \
937
969
  PACK_8_TO_BGR16(r_tmp, g_tmp, b_tmp, *dst)
938
970
 
939
971
#include "../csp_packed_packed.h"
964
996
 
965
997
#include "../csp_packed_packed.h"
966
998
 
 
999
#ifndef HQ
967
1000
 
968
1001
/* Conversion from RGBA 32 to RGB */
969
1002
 
1195
1228
  RGBA_64_TO_RGB_24(src[0], src[1], src[2], src[3], r_tmp, g_tmp, b_tmp)\
1196
1229
  PACK_8_TO_RGB15(r_tmp, g_tmp, b_tmp, *dst)
1197
1230
 
1198
 
#define INIT \
1199
 
  uint8_t r_tmp;\
1200
 
  uint8_t g_tmp;\
1201
 
  uint8_t b_tmp;\
1202
 
  INIT_RGBA_64
1203
 
 
 
1231
#ifdef HQ
 
1232
#define INIT \
 
1233
  int32_t round_tmp;\
 
1234
  uint8_t r_tmp;\
 
1235
  uint8_t g_tmp;\
 
1236
  uint8_t b_tmp;\
 
1237
  INIT_RGBA_64
 
1238
#else
 
1239
#define INIT \
 
1240
  uint8_t r_tmp;\
 
1241
  uint8_t g_tmp;\
 
1242
  uint8_t b_tmp;\
 
1243
  INIT_RGBA_64
 
1244
#endif
 
1245
  
1204
1246
#include "../csp_packed_packed.h"
1205
1247
 
1206
1248
/* rgba_64_to_bgr_15_c */
1215
1257
  RGBA_64_TO_RGB_24(src[0], src[1], src[2], src[3], r_tmp, g_tmp, b_tmp) \
1216
1258
  PACK_8_TO_BGR15(r_tmp, g_tmp, b_tmp, *dst)
1217
1259
 
1218
 
#define INIT \
1219
 
  uint8_t r_tmp;\
1220
 
  uint8_t g_tmp;\
1221
 
  uint8_t b_tmp;\
1222
 
  INIT_RGBA_64
 
1260
#ifdef HQ
 
1261
#define INIT \
 
1262
  int32_t round_tmp;\
 
1263
  uint8_t r_tmp;\
 
1264
  uint8_t g_tmp;\
 
1265
  uint8_t b_tmp;\
 
1266
  INIT_RGBA_64
 
1267
#else
 
1268
#define INIT \
 
1269
  uint8_t r_tmp;\
 
1270
  uint8_t g_tmp;\
 
1271
  uint8_t b_tmp;\
 
1272
  INIT_RGBA_64
 
1273
#endif
1223
1274
 
1224
1275
#include "../csp_packed_packed.h"
1225
1276
 
1235
1286
  RGBA_64_TO_RGB_24(src[0], src[1], src[2], src[3], r_tmp, g_tmp, b_tmp) \
1236
1287
  PACK_8_TO_RGB16(r_tmp, g_tmp, b_tmp, *dst)
1237
1288
 
1238
 
#define INIT \
1239
 
  uint8_t r_tmp;\
1240
 
  uint8_t g_tmp;\
1241
 
  uint8_t b_tmp;\
1242
 
  INIT_RGBA_64
 
1289
#ifdef HQ
 
1290
#define INIT \
 
1291
  int32_t round_tmp;\
 
1292
  uint8_t r_tmp;\
 
1293
  uint8_t g_tmp;\
 
1294
  uint8_t b_tmp;\
 
1295
  INIT_RGBA_64
 
1296
#else
 
1297
#define INIT \
 
1298
  uint8_t r_tmp;\
 
1299
  uint8_t g_tmp;\
 
1300
  uint8_t b_tmp;\
 
1301
  INIT_RGBA_64
 
1302
#endif
 
1303
 
1243
1304
 
1244
1305
#include "../csp_packed_packed.h"
1245
1306
 
1255
1316
  RGBA_64_TO_RGB_24(src[0], src[1], src[2], src[3], r_tmp, g_tmp, b_tmp) \
1256
1317
  PACK_8_TO_BGR16(r_tmp, g_tmp, b_tmp, *dst)
1257
1318
 
1258
 
#define INIT \
1259
 
  uint8_t r_tmp;\
1260
 
  uint8_t g_tmp;\
1261
 
  uint8_t b_tmp;\
1262
 
  INIT_RGBA_64
 
1319
#ifdef HQ
 
1320
#define INIT \
 
1321
  int32_t round_tmp;\
 
1322
  uint8_t r_tmp;\
 
1323
  uint8_t g_tmp;\
 
1324
  uint8_t b_tmp;\
 
1325
  INIT_RGBA_64
 
1326
#else
 
1327
#define INIT \
 
1328
  uint8_t r_tmp;\
 
1329
  uint8_t g_tmp;\
 
1330
  uint8_t b_tmp;\
 
1331
  INIT_RGBA_64
 
1332
#endif
 
1333
 
1263
1334
 
1264
1335
#include "../csp_packed_packed.h"
1265
1336
 
 
1337
#endif // !HQ
 
1338
 
1266
1339
/* rgba_64_to_rgb_24_c */
1267
1340
 
1268
1341
#define IN_TYPE  uint16_t
1274
1347
#define CONVERT \
1275
1348
  RGBA_64_TO_RGB_24(src[0], src[1], src[2], src[3], dst[0], dst[1], dst[2])
1276
1349
 
1277
 
#define INIT \
1278
 
  INIT_RGBA_64
1279
 
 
 
1350
#ifdef HQ
 
1351
#define INIT \
 
1352
  int32_t round_tmp;\
 
1353
  INIT_RGBA_64
 
1354
#else
 
1355
#define INIT \
 
1356
  INIT_RGBA_64
 
1357
#endif  
 
1358
  
1280
1359
#include "../csp_packed_packed.h"
1281
1360
 
1282
1361
/* rgba_64_to_bgr_24_c */
1290
1369
#define CONVERT \
1291
1370
  RGBA_64_TO_RGB_24(src[0], src[1], src[2], src[3], dst[2], dst[1], dst[0])
1292
1371
 
1293
 
#define INIT \
1294
 
  INIT_RGBA_64
 
1372
#ifdef HQ
 
1373
#define INIT \
 
1374
  int32_t round_tmp;\
 
1375
  INIT_RGBA_64
 
1376
#else
 
1377
#define INIT \
 
1378
  INIT_RGBA_64
 
1379
#endif  
1295
1380
 
1296
1381
#include "../csp_packed_packed.h"
1297
1382
 
1306
1391
#define CONVERT \
1307
1392
  RGBA_64_TO_RGB_24(src[0], src[1], src[2], src[3], dst[0], dst[1], dst[2])
1308
1393
 
1309
 
#define INIT \
1310
 
  INIT_RGBA_64
 
1394
#ifdef HQ
 
1395
#define INIT \
 
1396
  int32_t round_tmp;\
 
1397
  INIT_RGBA_64
 
1398
#else
 
1399
#define INIT \
 
1400
  INIT_RGBA_64
 
1401
#endif  
 
1402
 
1311
1403
 
1312
1404
#include "../csp_packed_packed.h"
1313
1405
 
1322
1414
#define CONVERT \
1323
1415
  RGBA_64_TO_RGB_24(src[0], src[1], src[2], src[3], dst[2], dst[1], dst[0])
1324
1416
 
1325
 
#define INIT \
1326
 
  INIT_RGBA_64
 
1417
#ifdef HQ
 
1418
#define INIT \
 
1419
  int32_t round_tmp;\
 
1420
  INIT_RGBA_64
 
1421
#else
 
1422
#define INIT \
 
1423
  INIT_RGBA_64
 
1424
#endif  
 
1425
 
1327
1426
 
1328
1427
#include "../csp_packed_packed.h"
1329
1428
 
 
1429
#ifndef HQ
 
1430
 
1330
1431
/* rgba_64_to_rgb_48_c */
1331
1432
 
1332
1433
#define IN_TYPE  uint16_t
1359
1460
 
1360
1461
#include "../csp_packed_packed.h"
1361
1462
 
 
1463
#endif // !HQ
 
1464
 
1362
1465
/* rgba_64_to_rgba_32_c */
1363
1466
 
1364
1467
#define IN_TYPE  uint16_t
1367
1470
#define OUT_ADVANCE 4
1368
1471
#define NUM_PIXELS  1
1369
1472
#define FUNC_NAME rgba_64_to_rgba_32_c
 
1473
 
1370
1474
#define CONVERT \
1371
 
  dst[0] = RGB_16_TO_8(src[0]); \
1372
 
  dst[1] = RGB_16_TO_8(src[1]); \
1373
 
  dst[2] = RGB_16_TO_8(src[2]); \
1374
 
  dst[3] = RGB_16_TO_8(src[3]);
1375
 
 
 
1475
  RGB_16_TO_8(src[0], dst[0]); \
 
1476
  RGB_16_TO_8(src[1], dst[1]); \
 
1477
  RGB_16_TO_8(src[2], dst[2]); \
 
1478
  RGB_16_TO_8(src[3], dst[3]); \
 
1479
 
 
1480
#ifdef HQ
 
1481
 
 
1482
#define INIT \
 
1483
  int32_t round_tmp;
 
1484
#endif  
 
1485
 
 
1486
  
1376
1487
#include "../csp_packed_packed.h"
1377
1488
 
 
1489
#ifndef HQ
 
1490
 
1378
1491
/* rgba_64_to_rgba_float_c */
1379
1492
 
1380
1493
#define IN_TYPE  uint16_t
1391
1504
 
1392
1505
#include "../csp_packed_packed.h"
1393
1506
 
1394
 
 
1395
1507
/* Conversion from RGBA 64 to RGB (ignoring alpha) */
1396
1508
 
1397
1509
/* rgba_64_to_rgb_15_ia_c */
1405
1517
#define CONVERT \
1406
1518
  PACK_16_TO_RGB15(src[0], src[1], src[2], *dst)
1407
1519
 
 
1520
#ifdef HQ
 
1521
#define INIT int32_t round_tmp;
 
1522
#endif
 
1523
  
1408
1524
#include "../csp_packed_packed.h"
1409
1525
 
1410
1526
/* rgba_64_to_bgr_15_ia_c */
1417
1533
#define FUNC_NAME rgba_64_to_bgr_15_ia_c
1418
1534
#define CONVERT \
1419
1535
  PACK_16_TO_BGR15(src[0], src[1], src[2], *dst)
 
1536
#ifdef HQ
 
1537
#define INIT int32_t round_tmp;
 
1538
#endif
1420
1539
 
1421
1540
 
1422
1541
#include "../csp_packed_packed.h"
1432
1551
#define CONVERT \
1433
1552
  PACK_16_TO_RGB16(src[0], src[1], src[2], *dst)
1434
1553
 
 
1554
#ifdef HQ
 
1555
#define INIT int32_t round_tmp;
 
1556
#endif
1435
1557
 
1436
1558
#include "../csp_packed_packed.h"
1437
1559
 
1445
1567
#define FUNC_NAME rgba_64_to_bgr_16_ia_c
1446
1568
#define CONVERT \
1447
1569
  PACK_16_TO_BGR16(src[0], src[1], src[2], *dst)
1448
 
 
 
1570
#ifdef HQ
 
1571
#define INIT int32_t round_tmp;
 
1572
#endif
 
1573
  
1449
1574
#include "../csp_packed_packed.h"
1450
1575
 
1451
1576
/* rgba_64_to_rgb_24_ia_c */
1452
1577
 
 
1578
#endif // !HQ
 
1579
 
1453
1580
#define IN_TYPE  uint16_t
1454
1581
#define OUT_TYPE uint8_t
1455
1582
#define IN_ADVANCE  4
1459
1586
#define CONVERT \
1460
1587
  COPY_48_TO_24
1461
1588
 
 
1589
#ifdef HQ
 
1590
#define INIT int32_t round_tmp;
 
1591
#endif
1462
1592
 
1463
1593
#include "../csp_packed_packed.h"
1464
1594
 
1472
1602
#define FUNC_NAME rgba_64_to_bgr_24_ia_c
1473
1603
#define CONVERT \
1474
1604
  SWAP_48_TO_24
 
1605
#ifdef HQ
 
1606
#define INIT int32_t round_tmp;
 
1607
#endif
1475
1608
 
1476
1609
#include "../csp_packed_packed.h"
1477
1610
 
1485
1618
#define FUNC_NAME rgba_64_to_rgb_32_ia_c
1486
1619
#define CONVERT \
1487
1620
  COPY_48_TO_24
 
1621
#ifdef HQ
 
1622
#define INIT int32_t round_tmp;
 
1623
#endif
1488
1624
 
1489
1625
#include "../csp_packed_packed.h"
1490
1626
 
1498
1634
#define FUNC_NAME rgba_64_to_bgr_32_ia_c
1499
1635
#define CONVERT \
1500
1636
  SWAP_48_TO_24
 
1637
#ifdef HQ
 
1638
#define INIT int32_t round_tmp;
 
1639
#endif
1501
1640
 
1502
1641
#include "../csp_packed_packed.h"
1503
1642
 
 
1643
#ifndef HQ
 
1644
 
1504
1645
/* rgba_64_to_rgb_48_ia_c */
1505
1646
 
1506
1647
#define IN_TYPE  uint16_t
1529
1670
 
1530
1671
/* Conversion from RGBA float to RGB */
1531
1672
 
 
1673
#endif // !HQ
 
1674
 
1532
1675
/* rgba_float_to_rgb_15_c */
1533
1676
 
1534
1677
#define IN_TYPE  float
1689
1832
 
1690
1833
#include "../csp_packed_packed.h"
1691
1834
 
 
1835
#ifndef HQ
 
1836
 
1692
1837
/* rgba_float_to_rgb_float_c */
1693
1838
 
1694
1839
#define IN_TYPE  float
1714
1859
#define NUM_PIXELS  1
1715
1860
#define FUNC_NAME rgba_float_to_rgba_32_c
1716
1861
#define CONVERT \
1717
 
  dst[0] = RGB_FLOAT_TO_8(src[0]);                    \
1718
 
  dst[1] = RGB_FLOAT_TO_8(src[1]);                    \
1719
 
  dst[2] = RGB_FLOAT_TO_8(src[2]);                    \
1720
 
  dst[3] = RGB_FLOAT_TO_8(src[3]);
 
1862
  RGB_FLOAT_TO_8(src[0], dst[0]);                    \
 
1863
  RGB_FLOAT_TO_8(src[1], dst[1]);                    \
 
1864
  RGB_FLOAT_TO_8(src[2], dst[2]);                    \
 
1865
  RGB_FLOAT_TO_8(src[3], dst[3]);
1721
1866
 
1722
1867
#include "../csp_packed_packed.h"
1723
1868
 
1730
1875
#define NUM_PIXELS  1
1731
1876
#define FUNC_NAME rgba_float_to_rgba_64_c
1732
1877
#define CONVERT \
1733
 
  dst[0] = RGB_FLOAT_TO_16(src[0]);                    \
1734
 
  dst[1] = RGB_FLOAT_TO_16(src[1]);                    \
1735
 
  dst[2] = RGB_FLOAT_TO_16(src[2]);                    \
1736
 
  dst[3] = RGB_FLOAT_TO_16(src[3]);
 
1878
  RGB_FLOAT_TO_16(src[0], dst[0]);                    \
 
1879
  RGB_FLOAT_TO_16(src[1], dst[1]);                    \
 
1880
  RGB_FLOAT_TO_16(src[2], dst[2]);                    \
 
1881
  RGB_FLOAT_TO_16(src[3], dst[3]);
1737
1882
 
1738
1883
#include "../csp_packed_packed.h"
1739
1884
 
1751
1896
#define INIT uint8_t r_tmp, g_tmp, b_tmp;
1752
1897
 
1753
1898
#define CONVERT                                 \
1754
 
  r_tmp = RGB_FLOAT_TO_8(src[0]);               \
1755
 
  g_tmp = RGB_FLOAT_TO_8(src[1]);               \
1756
 
  b_tmp = RGB_FLOAT_TO_8(src[2]);               \
 
1899
  RGB_FLOAT_TO_8(src[0], r_tmp);               \
 
1900
  RGB_FLOAT_TO_8(src[1], g_tmp);               \
 
1901
  RGB_FLOAT_TO_8(src[2], b_tmp);               \
1757
1902
  PACK_8_TO_RGB15(r_tmp, g_tmp, b_tmp, *dst)
1758
1903
 
1759
1904
#include "../csp_packed_packed.h"
1770
1915
#define INIT uint8_t r_tmp, g_tmp, b_tmp;
1771
1916
 
1772
1917
#define CONVERT                                 \
1773
 
  r_tmp = RGB_FLOAT_TO_8(src[0]);               \
1774
 
  g_tmp = RGB_FLOAT_TO_8(src[1]);               \
1775
 
  b_tmp = RGB_FLOAT_TO_8(src[2]);               \
 
1918
  RGB_FLOAT_TO_8(src[0], r_tmp);               \
 
1919
  RGB_FLOAT_TO_8(src[1], g_tmp);               \
 
1920
  RGB_FLOAT_TO_8(src[2], b_tmp);               \
1776
1921
  PACK_8_TO_BGR15(r_tmp, g_tmp, b_tmp, *dst)
1777
1922
 
1778
1923
#include "../csp_packed_packed.h"
1787
1932
#define FUNC_NAME rgba_float_to_rgb_16_ia_c
1788
1933
#define INIT uint8_t r_tmp, g_tmp, b_tmp;
1789
1934
#define CONVERT                                 \
1790
 
  r_tmp = RGB_FLOAT_TO_8(src[0]);               \
1791
 
  g_tmp = RGB_FLOAT_TO_8(src[1]);               \
1792
 
  b_tmp = RGB_FLOAT_TO_8(src[2]);               \
 
1935
  RGB_FLOAT_TO_8(src[0], r_tmp);               \
 
1936
  RGB_FLOAT_TO_8(src[1], g_tmp);               \
 
1937
  RGB_FLOAT_TO_8(src[2], b_tmp);               \
1793
1938
  PACK_8_TO_RGB16(r_tmp, g_tmp, b_tmp, *dst)
1794
1939
 
1795
1940
 
1805
1950
#define FUNC_NAME rgba_float_to_bgr_16_ia_c
1806
1951
#define INIT uint8_t r_tmp, g_tmp, b_tmp;
1807
1952
#define CONVERT                                 \
1808
 
  r_tmp = RGB_FLOAT_TO_8(src[0]);               \
1809
 
  g_tmp = RGB_FLOAT_TO_8(src[1]);               \
1810
 
  b_tmp = RGB_FLOAT_TO_8(src[2]);               \
 
1953
  RGB_FLOAT_TO_8(src[0], r_tmp);               \
 
1954
  RGB_FLOAT_TO_8(src[1], g_tmp);               \
 
1955
  RGB_FLOAT_TO_8(src[2], b_tmp);               \
1811
1956
  PACK_8_TO_BGR16(r_tmp, g_tmp, b_tmp, *dst)
1812
1957
 
1813
1958
#include "../csp_packed_packed.h"
1814
1959
 
 
1960
#endif // !HQ
 
1961
 
1815
1962
/* rgba_float_to_rgb_24_ia_c */
1816
1963
 
1817
1964
#define IN_TYPE  float
1877
2024
 
1878
2025
#include "../csp_packed_packed.h"
1879
2026
 
 
2027
#ifndef HQ
 
2028
 
 
2029
 
1880
2030
/* rgba_float_to_rgb_float_ia_c */
1881
2031
 
1882
2032
#define IN_TYPE  float
2012
2162
 
2013
2163
#include "../csp_packed_packed.h"
2014
2164
 
 
2165
#endif // !HQ
 
2166
 
2015
2167
/* rgb_48_to_rgba_32_c */
2016
2168
 
2017
2169
#define IN_TYPE  uint16_t
2023
2175
#define CONVERT \
2024
2176
  COPY_48_TO_24 \
2025
2177
  dst[3] = 0xff;
 
2178
#ifdef HQ
 
2179
#define INIT int32_t round_tmp;
 
2180
#endif
2026
2181
 
2027
2182
#include "../csp_packed_packed.h"
2028
2183
 
2040
2195
 
2041
2196
#include "../csp_packed_packed.h"
2042
2197
 
 
2198
#ifndef HQ
 
2199
 
2043
2200
/* Conversion from RGB formats to RGBA 64 */
2044
2201
 
2045
2202
/* rgb_15_to_rgba_64_c */
2176
2333
 
2177
2334
#include "../csp_packed_packed.h"
2178
2335
 
 
2336
#endif // !HQ
 
2337
 
2179
2338
/* rgb_float_to_rgba_64_c */
2180
2339
 
2181
2340
#define IN_TYPE  float
2190
2349
 
2191
2350
#include "../csp_packed_packed.h"
2192
2351
 
 
2352
#ifndef HQ
2193
2353
 
2194
2354
/* Conversion from RGB formats to RGBA Float */
2195
2355
 
2341
2501
 
2342
2502
#include "../csp_packed_packed.h"
2343
2503
 
2344
 
 
2345
 
void gavl_init_rgb_rgb_funcs_c(gavl_pixelformat_function_table_t * tab, const gavl_video_options_t * opt)
 
2504
#endif // !HQ
 
2505
 
 
2506
 
 
2507
#ifdef HQ
 
2508
void gavl_init_rgb_rgb_funcs_hq(gavl_pixelformat_function_table_t * tab,
 
2509
                                const gavl_video_options_t * opt)
 
2510
#else
 
2511
void gavl_init_rgb_rgb_funcs_c(gavl_pixelformat_function_table_t * tab,
 
2512
                               const gavl_video_options_t * opt)
 
2513
#endif
2346
2514
  {
2347
 
 
 
2515
#ifndef HQ
2348
2516
  tab->swap_rgb_24 = swap_rgb_24_c;
2349
2517
  tab->swap_rgb_32 = swap_rgb_32_c;
2350
2518
  tab->swap_rgb_16 = swap_rgb_16_c;
2373
2541
  tab->rgb_32_to_24    = rgb_32_to_24_c;
2374
2542
  tab->rgb_32_to_48    = rgb_32_to_48_c;
2375
2543
  tab->rgb_32_to_float = rgb_32_to_float_c;
2376
 
 
 
2544
  
2377
2545
  tab->rgb_48_to_15    = rgb_48_to_15_c;
2378
2546
  tab->rgb_48_to_16    = rgb_48_to_16_c;
 
2547
#endif // !HQ
2379
2548
  tab->rgb_48_to_24    = rgb_48_to_24_c;
2380
2549
  tab->rgb_48_to_32    = rgb_48_to_32_c;
 
2550
#ifndef HQ
2381
2551
  tab->rgb_48_to_float = rgb_48_to_float_c;
2382
2552
 
 
2553
#endif // !HQ
2383
2554
  tab->rgb_float_to_15    = rgb_float_to_15_c;
2384
2555
  tab->rgb_float_to_16    = rgb_float_to_16_c;
2385
2556
  tab->rgb_float_to_24    = rgb_float_to_24_c;
2386
2557
  tab->rgb_float_to_32    = rgb_float_to_32_c;
2387
2558
  tab->rgb_float_to_48    = rgb_float_to_48_c;
2388
2559
 
 
2560
#ifndef HQ
2389
2561
  
2390
2562
  tab->rgb_15_to_16_swap    = rgb_15_to_16_swap_c;
2391
2563
  tab->rgb_15_to_24_swap    = rgb_15_to_24_swap_c;
2413
2585
 
2414
2586
  tab->rgb_48_to_15_swap    = rgb_48_to_15_swap_c;
2415
2587
  tab->rgb_48_to_16_swap    = rgb_48_to_16_swap_c;
 
2588
#endif // !HQ
2416
2589
  tab->rgb_48_to_24_swap    = rgb_48_to_24_swap_c;
2417
2590
  tab->rgb_48_to_32_swap    = rgb_48_to_32_swap_c;
2418
2591
 
2425
2598
 
2426
2599
  if(opt->alpha_mode == GAVL_ALPHA_BLEND_COLOR)
2427
2600
    {
 
2601
#ifndef HQ
2428
2602
    tab->rgba_32_to_rgb_15    = rgba_32_to_rgb_15_c;
2429
2603
    tab->rgba_32_to_bgr_15    = rgba_32_to_bgr_15_c;
2430
2604
    tab->rgba_32_to_rgb_16    = rgba_32_to_rgb_16_c;
2440
2614
    tab->rgba_64_to_bgr_15 = rgba_64_to_bgr_15_c;
2441
2615
    tab->rgba_64_to_rgb_16 = rgba_64_to_rgb_16_c;
2442
2616
    tab->rgba_64_to_bgr_16 = rgba_64_to_bgr_16_c;
 
2617
#endif // !HQ
2443
2618
    tab->rgba_64_to_rgb_24 = rgba_64_to_rgb_24_c;
2444
2619
    tab->rgba_64_to_bgr_24 = rgba_64_to_bgr_24_c;
2445
2620
    tab->rgba_64_to_rgb_32 = rgba_64_to_rgb_32_c;
2446
2621
    tab->rgba_64_to_bgr_32 = rgba_64_to_bgr_32_c;
 
2622
#ifndef HQ
2447
2623
    tab->rgba_64_to_rgb_48 = rgba_64_to_rgb_48_c;
2448
2624
    tab->rgba_64_to_rgb_float = rgba_64_to_rgb_float_c;
 
2625
#endif // !HQ
2449
2626
 
2450
2627
    tab->rgba_float_to_rgb_15    = rgba_float_to_rgb_15_c;
2451
2628
    tab->rgba_float_to_bgr_15    = rgba_float_to_bgr_15_c;
2456
2633
    tab->rgba_float_to_rgb_32    = rgba_float_to_rgb_32_c;
2457
2634
    tab->rgba_float_to_bgr_32    = rgba_float_to_bgr_32_c;
2458
2635
    tab->rgba_float_to_rgb_48    = rgba_float_to_rgb_48_c;
 
2636
#ifndef HQ
2459
2637
    tab->rgba_float_to_rgb_float = rgba_float_to_rgb_float_c;
 
2638
#endif // !HQ
2460
2639
    }
2461
2640
  else if(opt->alpha_mode == GAVL_ALPHA_IGNORE)
2462
2641
    {
 
2642
#ifndef HQ
2463
2643
    tab->rgba_32_to_rgb_15    = rgb_32_to_15_c;
2464
2644
    tab->rgba_32_to_bgr_15    = rgb_32_to_15_swap_c;
2465
2645
    tab->rgba_32_to_rgb_16    = rgb_32_to_16_c;
2474
2654
    tab->rgba_64_to_bgr_15    = rgba_64_to_bgr_15_ia_c;
2475
2655
    tab->rgba_64_to_rgb_16    = rgba_64_to_rgb_16_ia_c;
2476
2656
    tab->rgba_64_to_bgr_16    = rgba_64_to_bgr_16_ia_c;
 
2657
#endif // !HQ
2477
2658
    tab->rgba_64_to_rgb_24    = rgba_64_to_rgb_24_ia_c;
2478
2659
    tab->rgba_64_to_bgr_24    = rgba_64_to_bgr_24_ia_c;
2479
2660
    tab->rgba_64_to_rgb_32    = rgba_64_to_rgb_32_ia_c;
2480
2661
    tab->rgba_64_to_bgr_32    = rgba_64_to_bgr_32_ia_c;
 
2662
#ifndef HQ
2481
2663
    tab->rgba_64_to_rgb_48    = rgba_64_to_rgb_48_ia_c;
2482
2664
    tab->rgba_64_to_rgb_float = rgba_64_to_rgb_float_ia_c;
2483
 
#if 1
 
2665
 
2484
2666
    tab->rgba_float_to_rgb_15    = rgba_float_to_rgb_15_ia_c;
2485
2667
    tab->rgba_float_to_bgr_15    = rgba_float_to_bgr_15_ia_c;
2486
2668
    tab->rgba_float_to_rgb_16    = rgba_float_to_rgb_16_ia_c;
2487
2669
    tab->rgba_float_to_bgr_16    = rgba_float_to_bgr_16_ia_c;
 
2670
#endif // !HQ
2488
2671
    tab->rgba_float_to_rgb_24    = rgba_float_to_rgb_24_ia_c;
2489
2672
    tab->rgba_float_to_bgr_24    = rgba_float_to_bgr_24_ia_c;
2490
2673
    tab->rgba_float_to_rgb_32    = rgba_float_to_rgb_32_ia_c;
2491
2674
    tab->rgba_float_to_bgr_32    = rgba_float_to_bgr_32_ia_c;
2492
2675
    tab->rgba_float_to_rgb_48    = rgba_float_to_rgb_48_ia_c;
 
2676
#ifndef HQ
2493
2677
    tab->rgba_float_to_rgb_float = rgba_float_to_rgb_float_ia_c;
2494
 
#endif
 
2678
#endif // !HQ
2495
2679
    }
2496
2680
  
 
2681
#ifndef HQ
2497
2682
  tab->rgba_32_to_rgba_64    = rgba_32_to_rgba_64_c;
2498
2683
  tab->rgba_32_to_rgba_float = rgba_32_to_rgba_float_c;
 
2684
#endif // !HQ
2499
2685
  
2500
2686
  tab->rgba_64_to_rgba_32    = rgba_64_to_rgba_32_c;
 
2687
#ifndef HQ
2501
2688
  tab->rgba_64_to_rgba_float = rgba_64_to_rgba_float_c;
 
2689
#endif // !HQ
2502
2690
  
 
2691
#ifndef HQ
2503
2692
  tab->rgba_float_to_rgba_32   = rgba_float_to_rgba_32_c;
2504
2693
  tab->rgba_float_to_rgba_64   = rgba_float_to_rgba_64_c;
2505
2694
  
2513
2702
  tab->bgr_24_to_rgba_32 = bgr_24_to_rgba_32_c;
2514
2703
  tab->rgb_32_to_rgba_32 = rgb_32_to_rgba_32_c;
2515
2704
  tab->bgr_32_to_rgba_32 = bgr_32_to_rgba_32_c;
 
2705
#endif // !HQ
2516
2706
  tab->rgb_48_to_rgba_32 = rgb_48_to_rgba_32_c;
2517
2707
  tab->rgb_float_to_rgba_32 = rgb_float_to_rgba_32_c;
 
2708
#ifndef HQ
2518
2709
 
2519
2710
  tab->rgb_15_to_rgba_64 = rgb_15_to_rgba_64_c;
2520
2711
  tab->bgr_15_to_rgba_64 = bgr_15_to_rgba_64_c;
2525
2716
  tab->rgb_32_to_rgba_64 = rgb_32_to_rgba_64_c;
2526
2717
  tab->bgr_32_to_rgba_64 = bgr_32_to_rgba_64_c;
2527
2718
  tab->rgb_48_to_rgba_64 = rgb_48_to_rgba_64_c;
 
2719
#endif // !HQ
2528
2720
  tab->rgb_float_to_rgba_64 = rgb_float_to_rgba_64_c;
2529
 
 
 
2721
#ifndef HQ
2530
2722
  tab->rgb_15_to_rgba_float = rgb_15_to_rgba_float_c;
2531
2723
  tab->bgr_15_to_rgba_float = bgr_15_to_rgba_float_c;
2532
2724
  tab->rgb_16_to_rgba_float = rgb_16_to_rgba_float_c;
2537
2729
  tab->bgr_32_to_rgba_float = bgr_32_to_rgba_float_c;
2538
2730
  tab->rgb_48_to_rgba_float = rgb_48_to_rgba_float_c;
2539
2731
  tab->rgb_float_to_rgba_float = rgb_float_to_rgba_float_c;
2540
 
 
 
2732
#endif // !HQ
2541
2733
  
2542
2734
  }
2543
2735
 
2544
 
/* Combine r, g and b values to a 16 bit rgb pixel (taken from avifile) */
2545
 
 
2546
2736
#undef COPY_24
2547
2737
#undef SWAP_24