fd = fopen('video_test_pattern_avalon_generator_source_data.txt'); //打开像素源文件
A = fscanf(fd,'%d'); //读入文件中的数据
fclose(fd);
%先申明向量用于存储数据
B = zeros(224,224);
C = zeros(224,224);
R1 = zeros(50176,1);
R2 = zeros(50176,1);
R3 = zeros(224,224);
G1 = zeros(50176,1);
G2 = zeros(50176,1);
G3 = zeros(224,224);
B1 = zeros(50176,1);
B2 = zeros(224,224);
for j = 1:224
for i = 1:224
B(j,i) = A((j-1)*224+i);
end
end
% 24-Bit RGB数据结构
% R---1111 1111 --- 0000 0000 --- 0000 0000 = 16711680
% G---0000 0000 --- 1111 1111 --- 0000 0000 = 65280
% B---0000 0000 --- 0000 0000 --- 1111 1111 = 255
%---R
for i = 1:50176
R1(i) = bitand(A(i),16711680); //与操作ÿ