[code] if (x<0)x=0;else if (x>255)x=255;
//颜色范围0-255;
// 1.原始:
if (tem_b<)tem_b=;else if (tem_b>)tem_b=;
if (tem_g<)tem_g=;else if (tem_g>)tem_g=;
if (tem_r<)tem_r=;else if (tem_r>)tem_r=;
//2.使用条件状态值生成掩码来移除条件分支
tem_b &=-(tem_b>=);//求负是为了生成掩码,也可以减1来生成掩码 <0
tem_b = (tem_b | -(tem_b>) ) & 0xFF;//>255
tem_g &=-(tem_g>=);
tem_g = (tem_g | -(tem_g>) ) & 0xFF;
tem_r &=-(tem_r>=);
tem_r = (tem_r | -(tem_r>) ) & 0xFF;
//3.使用带符号的移位生成掩码来移除条件分支 (建议使用该方案替代上面的条件状态值方案)
tem_b &=~(tem_b>>);
tem_b = (tem_b | ((-tem_b)>>) ) & 0xFF;
tem_g &=~(tem_g>>);
tem_g = (tem_g | ((-tem_g)>>) ) & 0xFF;
tem_r &=~(tem_r>>);
tem_r = (tem_r | ((-tem_r)>>) ) & 0xFF; //4.查表移除分支;
unsigned char_color_table[++];//假设color属于[-256..512]
unsigned char*color_table=&_color_table[];//先偏移256
//初始化 color_table;
for ( int i = -;i< ; i++)
{
if (i<) color_table[i]=;
else if (i>) color_table[i]=;
else color_table[i]=i;
}
...
resultRow[*x]=color_table[tem_b];
resultRow[*x+]=color_table[tem_g];
resultRow[*x+]=color_table[tem_r];
[code] if (x<0)x=0;else if (x>255)x=255;的更多相关文章
- 微软Visual Studio Code 0.8.0发布,新增多种主题
		
月30日,Build 开发者大会上,正式宣布了 Visual Studio Code 项目;并将其定义为:一个运行于 Mac OS X.Windows和 Linux 之上的,针对于编写现代 Web 和 ...
 - VS Code + NWJS(Node-Webkit)0.14.7 + SQLite3 + Angular6 构建跨平台桌面应用
		
一.项目需求 最近公司有终端桌面系统需求,需要支持本地离线运行(本地数据为主,云端数据同步),同时支持Window XP,最好跨平台.要求安装配置简单(一次性打包安装),安装包要小,安装时间短,可离线 ...
 - ORA-00600: internal error code, arguments: [2662], [0], [1106971], [0], [1107731], [12583040]
		
今天是2014-06-06,在进行数据库恢复的时候出现了一个久违的ora-600 [2662]错误.特整理例如以下: 问题描写叙述: system及数据文件误删,採用恢复数据文件的方式将数据库恢复到開 ...
 - 07 oracle 归档模式 inactive/current redo log损坏修复--以及错误ORA-00600: internal error code, arguments: [2663], [0], [9710724], [0], [9711142], [], [], [], [], [], [], []
		
07 oracle 归档模式 inactive/current redo log损坏修复--以及错误ORA-00600: internal error code, arguments: [2663], ...
 - QR code & auto login &  OAuth 2.0
		
QR code & auto login & OAuth 2.0 扫码自动登录原理解析 https://www.ximalaya.com/shangye/14685881/958686 ...
 - Error Code: 1366. Incorrect DECIMAL value: '0' for column '' at row -1	0.266 sec;
		
Reference: https://stackoverflow.com/questions/35037288/incorrect-decimal-integer-value-mysql Er ...
 - caffe: test code 执行出问题: Check failed: FLAGS_weights.size() > 0 (0 vs. 0) Need model weights to score.
		
Check failed: FLAGS_weights.size() > 0 (0 vs. 0) Need model weights to score. 出现这个错误,但是我记得昨天还好好的, ...
 - Oracle Database 11g Release 2(11.2.0.3.0) RAC On Redhat Linux 5.8 Using Vmware Workstation 9.0
		
一,简介 二,配置虚拟机 1,创建虚拟机 (1)添加三块儿网卡: 主节点 二节点 eth0: 公网 192.168.1.20/24 NAT eth0: 公网 192.168.1 ...
 - ps6 安装失败-FATAL: Payload '{3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.98.0' information not found in Media_db.
		
点击 '错误摘要' Exit Code: 34 -------------------------------------- Summary ----------------------------- ...
 - [转]Could not load file or assembly 'System.Core, Version=2.0.5.0 和autofac冲突的问题
		
Could not load file or assembly 'System.Core, Version=2.0.5.0 和autofac冲突的问题 来源:http://www.cnblogs.co ...
 
随机推荐
- Http学习(一)
			
HTTP 超文本传输协议 综述: HTTP(HyperText Transfer Protocol)是一套计算机通过网络进行通信的规则.计算机专家设计出HTTP,使HTTP客户(如Web浏览器)能够从 ...
 - R:ggplot2数据可视化——进阶(2)
			
Part 2: Customizing the Look and Feel, 更高级的自定义化,比如说操作图例.注记.多图布局等 # Setup options(scipen=999) librar ...
 - [ javasript ] javascript中的each遍历!
			
1.数组中的each var arr = [ "one", "two", "three", "four"]; $.eac ...
 - 2016.8.19上午初中部NOIP普及组比赛总结
			
2016.8.19上午初中部NOIP普及组比赛总结 链接:https://jzoj.net/junior/#contest/home/1338 这次总结发得有点晚啊!我在这里解释一下, 因为浏览器的问 ...
 - 廖雪峰Java11多线程编程-3高级concurrent包-8CompletableFuture
			
使用Future可以获得异步执行结果 Future<String> future = executor.submit(task); String result = future.get() ...
 - HZOI20190725 B 回家 tarjan
			
题目大意:https://www.cnblogs.com/Juve/articles/11226266.html 题解: 感觉挺水的,但考场上没打出来 题目翻译一下就是输出起点到终点必经的点 其实就是 ...
 - 传递闭包+求概率——列项相消法lightoj1321好题
			
主要是要想到边与边的通过概率是独立的,所以先求出最终的概率,然后用推出的公式求总期望即可 最终概率E[0][n-1],可以用传递闭包来做 裂项相消法都不会了.. /* 闭包上推期望 每条边都具有独立性 ...
 - JavaScript 数组(Array)方法(二)
			
forEach ES5新增的方法,Arr.forEach((value, index,array)=>{}); let arr=['a','b','c']; arr.forEach((val,i ...
 - 菜鸟nginx源码剖析数据结构篇(八) 缓冲区链表ngx_chain_t[转]
			
菜鸟nginx源码剖析数据结构篇(八) 缓冲区链表 ngx_chain_t Author:Echo Chen(陈斌) Email:chenb19870707@gmail.com Blog:Blog.c ...
 - 深入浅出 Java Concurrency (39): 并发总结 part 3 常见的并发陷阱
			
常见的并发陷阱 volatile volatile只能强调数据的可见性,并不能保证原子操作和线程安全,因此volatile不是万能的.参考指令重排序 volatile最常见于下面两种场景. a. 循环 ...