Code covered by the BSD License  

Highlights from
3D-SPIHT

from 3D-SPIHT by DIONYSIOS ATHANASOPOULOS
The 3D Set Partitioning In Hierarchical Trees Matlab Code

myfunc_read_cif(nFrame,in_file_name)
function [Y] = myfunc_read_cif(nFrame,in_file_name)
%
%  This function reads CIF,SIF,QCIF 4:2:0 video files and
%  shows the Y component (luminance)
%  nFrame: number of frames to be read from the file specified
%

[fid message]= fopen(in_file_name,'rb');
% input video format
if length(strfind(in_file_name, 'cif')) > 0
    nRow = 288;
    nColumn = 352;
elseif length(strfind(in_file_name, 'qcif')) > 0
    nRow = 288 / 2;
    nColumn = 352 / 2;
elseif length(strfind(in_file_name, 'sif')) > 0
    nRow = 240;
    nColumn = 352;      
end

for i = 1: nFrame
    % read  component
	img_y = fread(fid, nRow * nColumn, 'uchar');
    img_y = reshape(img_y, nColumn, nRow);
    img_y = img_y';

    Y(:,:,i) = img_y;
    imshow(uint8(img_y));
    
    % read U component    
    img_u = fread(fid, nRow * nColumn / 4, 'uchar');
    img_u = reshape(img_u, nColumn/2, nRow/2);
    img_u = img_u';

    % read V component 
    img_v = fread(fid, nRow * nColumn / 4, 'uchar');
    img_v = reshape(img_v, nColumn/2, nRow/2);
    img_v = img_v';

end

fclose(fid);
disp('ok');

Contact us at files@mathworks.com