>>50
*mono_buffer =(r+g+b)/3;
↓
*mono_buffer = 0.299 * r + 0.587 * g + 0.114 * b;