main44old.m
上传用户:cxsjwj
上传日期:2022-08-09
资源大小:34k
文件大小:4k
- clc
- tic
- aviobj = avifile('2.avi','fps',25,'COMPRESSION','None');
- %motion Vectors
- motionVect=zeros(2,256);
- fid=fopen('Qtable2.txt','r');
- %array is quantization matrix
- array=fscanf(fid,'%e',[8,inf]);
- %array=2*array;
- i = 0;
- %flag to tell if B frame was predicted from I or P frame flag=1 P frame
- %flag=0 I frame
- flag=2;
- %GOP is of 10 pictures IBBPBBPBBI
- mov=aviread('news.avi');
- movinfo=aviinfo('news.avi');
- noframe=movinfo.NumFrames;
- %mbSize macroblock size used for motion estimation
- mbSize = 8;
- %p for search area
- p = 7;
- global I1 I1d P4d P7d I10d B2d B3d B5d B6d B8d B9d
- array=array;
- for i=85:10:95
- i
- framedata=aviread('news.avi',i);
- I1=frame2im(framedata);
-
- if resize==1
- I1=imresize(I1,[long,wide]);
- end
-
-
- I1=I1(:,:,1);
- main441
- layer1
-
- framedata=aviread('news.avi',i);
- I1=frame2im(framedata);
- if resize==1
- I1=imresize(I1,[long,wide]);
- end
-
- I1=I1(:,:,2);
- main442
- layer2
-
- framedata=aviread('news.avi',i);
- I1=frame2im(framedata);
- if resize==1
- I1=imresize(I1,[long,wide]);
- end
-
- I1=I1(:,:,3);
- main443
- layer3
- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
- if i==1
- imshow(uint8(I1d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B2d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B3d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(P4d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B5d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B6d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(P7d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B8d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B9d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(I10d1))
- aviobj = addframe(aviobj,getframe);
- clf;
- else
-
- imshow(uint8(B2d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B3d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(P4d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B5d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B6d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(P7d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B8d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(B9d1))
- aviobj = addframe(aviobj,getframe);
- clf;
-
- imshow(uint8(I10d1))
- aviobj = addframe(aviobj,getframe);
- clf;
- end
- framedata=aviread('news.avi',i+9);
- I10=frame2im(framedata);
- %I10=imresize(I10,[128 128]);
-
-
-
-
- end
- aviobj = close(aviobj);
- toc