Revision: 76987
          http://sourceforge.net/p/brlcad/code/76987
Author:   brlcad
Date:     2020-08-30 18:38:46 +0000 (Sun, 30 Aug 2020)
Log Message:
-----------
use more precision to more closely match the standard for ntsc.  add additional 
conversion modes for hdtv, hdr, and the default simple averaging as an explicit 
mode.  no consideration of linear vs non-linear.

Modified Paths:
--------------
    brlcad/trunk/src/util/pix-bw.c

Modified: brlcad/trunk/src/util/pix-bw.c
===================================================================
--- brlcad/trunk/src/util/pix-bw.c      2020-08-28 13:10:37 UTC (rev 76986)
+++ brlcad/trunk/src/util/pix-bw.c      2020-08-30 18:38:46 UTC (rev 76987)
@@ -21,12 +21,6 @@
  *
  * Converts a RGB pix file into an 8-bit BW file.
  *
- * By default it will weight the RGB values evenly.
- * -ntsc will use weights for NTSC standard primaries and
- *       NTSC alignment white.
- * -crt  will use weights for "typical" color CRT phosphors and
- *       a D6500 alignment white.
- *
  */
 
 #include "common.h"
@@ -63,7 +57,7 @@
 
 static const char usage[] = "\
 Usage: pix-bw [-s squaresize] [-w width] [-n height]\n\
-              [ [-e ntsc|crt] [[-R red_weight] [-G green_weight] [-B 
blue_weight]] ]\n\
+              [ [-e ntsc|crt|hdtv|hdr|avg] [[-R red_weight] [-G green_weight] 
[-B blue_weight]] ]\n\
               [-o out_file.bw] [[<] file.pix] [> out_file.bw]\n";
 
 int
@@ -75,16 +69,31 @@
     while ((c = bu_getopt(argc, argv, "e:s:w:n:R:G:B:o:h?")) != -1) {
        switch (c) {
            case 'e' :
-               if (BU_STR_EQUAL(bu_optarg, "ntsc")) {
-                   rweight = 0.30;
-                   gweight = 0.59;
-                   bweight = 0.11;
+               if (BU_STR_EQUAL(bu_optarg, "avg")) {
+                   rweight = 0.0;
+                   gweight = 0.0;
+                   bweight = 0.0;
                }
+               else if (BU_STR_EQUAL(bu_optarg, "ntsc")) {
+                   rweight = 0.299;
+                   gweight = 0.587;
+                   bweight = 0.114;
+               }
                else if (BU_STR_EQUAL(bu_optarg, "crt")) {
                    rweight = 0.26;
                    gweight = 0.66;
                    bweight = 0.08;
                }
+               else if (BU_STR_EQUAL(bu_optarg, "hdtv")) {
+                   rweight = 0.2126;
+                   gweight = 0.7152;
+                   bweight = 0.0722;
+               }
+               else if (BU_STR_EQUAL(bu_optarg, "hdr")) {
+                   rweight = 0.2627;
+                   gweight = 0.6780;
+                   bweight = 0.0593;
+               }
                else {
                    fprintf(stderr,"pix-bw: invalid -e argument\n");
                    return 0;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to