these red pixels look more like a bug in VNG implementation to me.
After a more careful inspection, yes :-)
My test image was a RAW file as from the camera, name IMG_4592.CR2
1. Opening this RAW in PixInsight with dcraw, VNG method selected, the result is OK, at least not showing the red dots (screenshot top left: label "dcraw")
2. Opening this RAW in PixInsight as CFA gray and then VNG debayering, the result is also OK, even better than dcraw. So you did a good job in your debayering code!! (screenshot top right: "IMG_49521_RGB_VNG")
Now to the part that made me headaches.
3. Calibrating the file as a CFA gray RAW and then VNG debayering, the result shows the red dots (screenshot bottom right, label: IMG_4592_calibrated_RGB_RGB_VNG). For better viewing, I converted the CFA gray to RGB, cropped a relevant part and attached it as TIFF to this mail. There is nothing special with the calibrated CFA RGB, see screenshot bottom left.
All the spurious red dots are not "invented" ones on G or B-positions! They all come from the R-position of the bayer matrix, but did not get G and/or B-values.
- the first red dot got no green value (R,G,B = 0.04, 0, 0.01 ), x,y = 48,34
- the second red dot got neither green no blue (R,G,B = 0.06, 0, 0 ), x,y = 44,36
- same for the third red dot (R = 0.01), x,y= 42,44
From my own experiences with debayering algorithms, it could be the unintentional clamping of temporary negative values to zero. Maybe this is a starting point for you to look inside your code.
RĂ¼diger