www.gusucode.com > visionhdl工具箱matlab源码程序 > visionhdl/visionhdlutilities/@visionhdlsupport/@MedianFilter/cgireml/memReadFSM3.m
function [backPorchStart,inPorch,inFrontLine,inBackLine,endLineP,inLine] = memReadFSM3(readStart,readBackcount,isEndLine,rhline_cnt,rflines_cnt,vsRst,bSize) persistent readState stype = numerictype(0,3,0); backPorchStart = false; endLineP = false; inFrontLine = false; inBackLine = false; inPorch = false; inLine = false; if isempty(readState) readState = fi(0,'numerictype',stype); %0; end if vsRst readState = fi(0,'numerictype',stype); elseif readStart switch (readState) case 0 %'wait' backPorchStart = false; inPorch = true; inLine = true; if rhline_cnt < bSize-1 readState = fi(1,'numerictype',stype);%1; else if rflines_cnt < bSize readState = fi(2,'numerictype',stype);%2; inFrontLine = true; elseif readBackcount readState = fi(4,'numerictype',stype);%4; inBackLine = true; else readState = fi(3,'numerictype',stype);%3; inFrontLine = false; end end case 1 %front porch inPorch = true; inLine = true; if rhline_cnt < bSize-1 readState = fi(1,'numerictype',stype);%1; else if rflines_cnt < bSize readState = fi(2,'numerictype',stype);%2; inFrontLine = true; elseif readBackcount readState = fi(4,'numerictype',stype);%4; inBackLine = true; else readState = fi(3,'numerictype',stype);%3; inFrontLine = false; end end case 2 % front lines inFrontLine = true; inLine = true; if isEndLine inPorch = true; % if NSize == 3 readState = fi(0,'numerictype',stype);%0; endLineP = true; inLine = false; else inPorch = false; readState = fi(2,'numerictype',stype);%2;e end case 3 % lines inLine = true; if isEndLine % back proch inPorch = true; % if NSize == 3 % endLineProcess(); readState = fi(0,'numerictype',stype);%0; endLineP = true; inLine = false; else inPorch = false; readState = fi(3,'numerictype',stype);%3; end case 4 % back lines inBackLine = true; inLine = true; if isEndLine % back proch inPorch = true; % if NSize == 3 % endLineProcess(); readState = fi(0,'numerictype',stype);%0; endLineP = true; inLine = false; else inPorch = false; readState = fi(4,'numerictype',stype);%4; end end end