コード例 #1
0
static int
get_buffer_size (GstSchroDec *schro_dec)
{
  int size;
  int width = schro_dec->width;
  int height = schro_dec->height;

  switch (schro_dec->fourcc) {
    case GST_MAKE_FOURCC('I','4','2','0'):
      size = ROUND_UP_POW2(width,2) * ROUND_UP_POW2(height,1);
      size += 2 * ROUND_UP_POW2(ROUND_UP_SHIFT(width,1),2) *
        ROUND_UP_SHIFT(height,1);
      break;
    case GST_MAKE_FOURCC('Y','U','Y','2'):
      size = ROUND_UP_POW2(width,2) * 2 * height;
      break;
    case GST_MAKE_FOURCC('A','Y','U','V'):
      size = width * 4 * height;
      break;
    default:
      g_assert_not_reached();
      break;
  }

  return size;
}
コード例 #2
0
void
schro_encoder_frame_downsample (SchroEncoderFrame *frame)
{
  int i;

  SCHRO_DEBUG("downsampling frame %d", frame->frame_number);

  for(i=0;i<5;i++){
    frame->downsampled_frames[i] =
      schro_frame_new_and_alloc (NULL, frame->filtered_frame->format,
          ROUND_UP_SHIFT(frame->filtered_frame->width, i+1),
          ROUND_UP_SHIFT(frame->filtered_frame->height, i+1));
  }

  schro_frame_downsample (frame->downsampled_frames[0],
      frame->filtered_frame);
  schro_frame_downsample (frame->downsampled_frames[1],
      frame->downsampled_frames[0]);
  schro_frame_downsample (frame->downsampled_frames[2],
      frame->downsampled_frames[1]);
  schro_frame_downsample (frame->downsampled_frames[3],
      frame->downsampled_frames[2]);
  schro_frame_downsample (frame->downsampled_frames[4],
      frame->downsampled_frames[3]);
}