wavedec2 performs a 2D multilevel wavelet decomposition of an input matrix X. It returns the wavelet coefficients as a vector C and bookkeeping information in a matrix S. The decomposition can be done to N levels using either a named wavelet filter or by specifying the low-pass and high-pass filters. C contains the approximation and detail coefficients organized by level, and S provides the size of each subset of coefficients.