Exemplo n.º 1
0
/** Converts a coefficient block in raster order into a vector in
 * coding scan order with the PVQ partitions laid out one after
 * another.  This works in stages; the 4x4 conversion is applied to
 * the coefficients nearest DC, then the 8x8 applied to the 8x8 block
 * nearest DC that was not already coded by 4x4, then 16x16 following
 * the same pattern.
 *
 * @param [out]    dst        destination vector
 * @param [in]     n          block size (along one side)
 * @param [in]     src        source coefficient block
 * @param [in]     stride     source vector row stride
 * @param [in]     interleave interleaves entries for the scalar
                              (non-pvq) case
 */
void od_raster_to_coding_order(od_coeff *dst,  int n, od_coeff *src, int stride,
 int interleave) {
  od_coeff tmp1[1024];
  od_band_from_raster(&od_layout4, dst+1, src, stride);
  if (n >= 8) {
    int i;
    od_band_from_raster(&od_layout8, dst+16, src, stride);
    if (interleave) {
      for (i = 0; i < 8; i++) {
        tmp1[2*i] = dst[16+i];
        tmp1[2*i+1] = dst[24+i];
      }
      for (i = 0; i < 16; i++) {
        dst[16+i] = tmp1[i];
      }
    }
  }
  if (n >= 16) {
    int i;
    od_band_from_raster(&od_layout16, dst+64, src, stride);
    if (interleave) {
      for (i = 0; i < 32; i++) {
        tmp1[2*i] = dst[64+i];
        tmp1[2*i+1] = dst[96+i];
      }
      for (i = 0; i < 64; i++) {
        dst[64+i] = tmp1[i];
      }
    }
  }
  dst[0] = src[0];
}
Exemplo n.º 2
0
/** Converts a coefficient block in raster order into a vector in
 * coding scan order with the PVQ partitions laid out one after
 * another.  This works in stages; the 4x4 conversion is applied to
 * the coefficients nearest DC, then the 8x8 applied to the 8x8 block
 * nearest DC that was not already coded by 4x4, then 16x16 following
 * the same pattern.
 *
 * @param [out]    dst        destination vector
 * @param [in]     n          block size (along one side)
 * @param [in]     src        source coefficient block
 * @param [in]     stride     source vector row stride
 * @param [in]     interleave interleaves entries for the scalar
                              (non-pvq) case
 */
void od_raster_to_coding_order(od_coeff *dst,  int n, od_coeff *src,
 int stride) {
  /* TODO - Rewrite these as a loop. */
  od_band_from_raster(&OD_LAYOUT4, dst + 1, src, stride);
  if (n >= 8) {
    od_band_from_raster(&OD_LAYOUT8, dst + 16, src, stride);
  }
  if (n >= 16) {
    od_band_from_raster(&OD_LAYOUT16, dst + 64, src, stride);
  }
  if (n >= 32) {
    od_band_from_raster(&OD_LAYOUT32, dst + 256, src, stride);
  }
  if (n >= 64) {
    od_band_from_raster(&OD_LAYOUT64, dst + 1024, src, stride);
  }
  dst[0] = src[0];
}
Exemplo n.º 3
0
/** Converts a coefficient block in raster order into a vector in
 * coding scan order with the PVQ partitions laid out one after
 * another.  This works in stages; the 4x4 conversion is applied to
 * the coefficients nearest DC, then the 8x8 applied to the 8x8 block
 * nearest DC that was not already coded by 4x4, then 16x16 following
 * the same pattern.
 *
 * @param [out]    dst        destination vector
 * @param [in]     n          block size (along one side)
 * @param [in]     src        source coefficient block
 * @param [in]     stride     source vector row stride
 */
void od_raster_to_coding_order(od_coeff *dst, int n, const od_coeff *src,
 int stride) {
  int bs;
  /* dst + 1 because DC is not included for 4x4 blocks. */
  od_band_from_raster(OD_LAYOUTS[0], dst + 1, src, stride);
  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_band_from_raster(OD_LAYOUTS[bs], dst + offset, src, stride);
    }
  }
  dst[0] = src[0];
}