image thumbnail
from Elphel JP4 image manipulating by Konstantin Kim
Decoding JP4 images, produced by Elphel network cams.

y=deblock16x16(I)
function y=deblock16x16(I)

y0=uint8(zeros(size(I)));
for x=1:16:size(I,1)
	for y=1:16:size(I,2)
		blk16=I(x:x+15,y:y+15);
		for dx=0:7
			for dy=0:7
				y0(x+2*dx  ,y+2*dy)   = blk16(dx+1,dy+1);
				y0(x+2*dx+1,y+2*dy)   = blk16(dx+9,dy+1);
				y0(x+2*dx  ,y+2*dy+1) = blk16(dx+1,dy+9);
				y0(x+2*dx+1,y+2*dy+1) = blk16(dx+9,dy+9);
			end
		end
	end
end
y=y0;

Contact us at files@mathworks.com