I am trying to develop a smoke detector from an encoder MJpeg through my studies.The approach is by block. Thus for each 8x8 block in motion, it is estimated the existence of smoke from the DCT coefficients of the block available at the MJPEG encoder. A preliminary step for estimating the smoke detection is the motion detection. Indeed, any moving block is a potential candidate that may contain smoke. So I have to insert a routine that recognizes if the block is a motion block.This routine uses the SAD between the current block and the corresponding block in the image preceding the current image of 30 frames. How can I implement this principle? I Think I need to put in the SDRAM 30 frames preceding each image and transfer by DMA the appropriate block. Which means that would allow me to manage this process through SDRAM?