clc ;
clear ;

fname = 'Bal256x192_8views_t0.yuv' ;
fid = fopen('Bal256x192_compare_final.yuv','w') ;

for i = 1 : 7
    [Y U V] = read_ith_GOP_keyframe(i-1,1,256,192,fname) ;
    Y_img = [Y Y] ;
    U_img = [U U] ;
    V_img = [V V] ;
    fwrite(fid,Y_img','uint8') ;
    fwrite(fid,U_img','uint8') ;
    fwrite(fid,V_img','uint8') ;
%    s = ['load novel_view_' num2str(i+30) ' ;'] ;
    s = ['load optimized_view_' num2str(i+1000) ' ;'] ;
    eval(s) ;
    Y_img = [Y nv_from1and2_Y] ;
    U_img = [U nv_from1and2_U] ;
    V_img = [V nv_from1and2_V] ;
    fwrite(fid,Y_img','uint8') ;
    fwrite(fid,U_img','uint8') ;
    fwrite(fid,V_img','uint8') ;
end
[Y U V] = read_ith_GOP_keyframe(7,1,256,192,fname) ;
Y_img = [Y Y] ;
U_img = [U U] ;
V_img = [V V] ;
fwrite(fid,Y_img','uint8') ; fwrite(fid,U_img','uint8') ; fwrite(fid,V_img','uint8') ;
fwrite(fid,Y_img','uint8') ; fwrite(fid,U_img','uint8') ; fwrite(fid,V_img','uint8') ;
fclose(fid) ;



