/** Converts a vector in coding scan order witht he PVQ partitions * laid out one after another into a coefficient block in raster * order. This works in stages in the reverse order of raster->scan * order; the 16x16 conversion is applied to the coefficients that * don't appear in an 8x8 block, then the 8x8 applied to the 8x8 block * sans the 4x4 block it contains, then 4x4 is converted sans DC. * * @param [out] dst destination coefficient block * @param [in] stride destination vector row stride * @param [in] src source vector * @param [in] n block size (along one side) * @param [in] interleave de-interleaves entries for the scalar (non-pvq) case */ void od_coding_order_to_raster(od_coeff *dst, int stride, od_coeff *src, int n, int interleave) { od_raster_from_band(&od_layout4, dst, stride, src+1); if (n >= 8) { if (interleave) { int i; od_coeff tmp1[1024]; for (i = 0; i < 16; i++) { tmp1[i] = src[16 + i]; } for (i = 0; i < 8; i++) { src[16+i] = tmp1[2*i]; src[24+i] = tmp1[2*i + 1]; } } od_raster_from_band(&od_layout8, dst, stride, src+16); } if (n >= 16) { if (interleave) { int i; od_coeff tmp1[1024]; for (i = 0; i < 64; i++) { tmp1[i] = src[64 + i]; } for (i = 0; i < 32; i++) { src[64+i] = tmp1[2*i]; src[96+i] = tmp1[2*i + 1]; } } od_raster_from_band(&od_layout16, dst, stride, src+64); } dst[0] = src[0]; }
/** Converts a vector in coding scan order witht he PVQ partitions * laid out one after another into a coefficient block in raster * order. This works in stages in the reverse order of raster->scan * order; the 16x16 conversion is applied to the coefficients that * don't appear in an 8x8 block, then the 8x8 applied to the 8x8 block * sans the 4x4 block it contains, then 4x4 is converted sans DC. * * @param [out] dst destination coefficient block * @param [in] stride destination vector row stride * @param [in] src source vector * @param [in] n block size (along one side) * @param [in] interleave de-interleaves entries for the scalar (non-pvq) case */ void od_coding_order_to_raster(od_coeff *dst, int stride, od_coeff *src, int n) { /* TODO - Rewrite these as a loop. */ od_raster_from_band(&OD_LAYOUT4, dst, stride, src + 1); if (n >= 8) { od_raster_from_band(&OD_LAYOUT8, dst, stride, src + 16); } if (n >= 16) { od_raster_from_band(&OD_LAYOUT16, dst, stride, src + 64); } if (n >= 32) { od_raster_from_band(&OD_LAYOUT32, dst, stride, src + 256); } if (n >= 64) { od_raster_from_band(&OD_LAYOUT64, dst, stride, src + 1024); } dst[0] = src[0]; }
/** Converts a vector in coding scan order witht he PVQ partitions * laid out one after another into a coefficient block in raster * order. This works in stages in the reverse order of raster->scan * order; the 16x16 conversion is applied to the coefficients that * don't appear in an 8x8 block, then the 8x8 applied to the 8x8 block * sans the 4x4 block it contains, then 4x4 is converted sans DC. * * @param [out] dst destination coefficient block * @param [in] stride destination vector row stride * @param [in] src source vector * @param [in] n block size (along one side) */ void od_coding_order_to_raster(od_coeff *dst, int stride, const od_coeff *src, int n) { int bs; /* src + 1 because DC is not included for 4x4 blocks. */ od_raster_from_band(OD_LAYOUTS[0], dst, stride, src + 1); for (bs = 1; bs < OD_NBSIZES; bs++) { int size; int offset; /* Length of block size > 4 */ size = 1 << (OD_LOG_BSIZE0 + bs); /* Offset is the size of the previous block squared. */ offset = 1 << 2*(OD_LOG_BSIZE0 - 1 + bs); if (n >= size) { /* 3 16x16 bands come after 3 8x8 bands, which come after 2 4x4 bands. */ od_raster_from_band(OD_LAYOUTS[bs], dst, stride, src + offset); } } dst[0] = src[0]; }