| OLD | NEW |
| 1 function writeYUV420file(filename, Y, U, V) | 1 function writeYUV420file(filename, Y, U, V) |
| 2 % writeYUV420file(filename, Y, U, V) | 2 % writeYUV420file(filename, Y, U, V) |
| 3 | 3 |
| 4 fid = fopen(filename,'wb'); | 4 fid = fopen(filename,'wb'); |
| 5 if fid==-1 | 5 if fid==-1 |
| 6 error(['Cannot open file ' filename]); | 6 error(['Cannot open file ' filename]); |
| 7 end | 7 end |
| 8 | 8 |
| 9 numFrames=size(Y,3); | 9 numFrames=size(Y,3); |
| 10 | 10 |
| 11 for k=1:numFrames | 11 for k=1:numFrames |
| 12 % Write luminance | 12 % Write luminance |
| 13 fwrite(fid,uint8(Y(:,:,k).'), 'uchar'); | 13 fwrite(fid,uint8(Y(:,:,k).'), 'uchar'); |
| 14 | 14 |
| 15 % Write U channel | 15 % Write U channel |
| 16 fwrite(fid,uint8(U(:,:,k).'), 'uchar'); | 16 fwrite(fid,uint8(U(:,:,k).'), 'uchar'); |
| 17 | 17 |
| 18 % Write V channel | 18 % Write V channel |
| 19 fwrite(fid,uint8(V(:,:,k).'), 'uchar'); | 19 fwrite(fid,uint8(V(:,:,k).'), 'uchar'); |
| 20 end | 20 end |
| 21 | 21 |
| 22 fclose(fid); | 22 fclose(fid); |
| OLD | NEW |