store.c

来自「h.263+ vc++商业源代码」· C语言 代码 · 共 68 行

C
68
字号

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <io.h>

#include "config.h"
#include "global.h"

/* private prototypes */
static void store_yuv_append _ANSI_ARGS_((unsigned char *src[],
  int offset, int incr, int height));
static void store_yuv1 _ANSI_ARGS_((unsigned char *src,
  int offset, int incr, int width, int height, int append));
static void putbyte _ANSI_ARGS_((int c));
static void putword _ANSI_ARGS_((int w));


/*
 * store a picture as either one frame or two fields
 */
void storeframe(src,frame)
unsigned char *src[];
int frame;
{
  store_yuv_append(src,0,coded_picture_width,vertical_size);
}

/*
 * store one frame or one field
 */


/* concatenated headerless file for y, u and v */
static void store_yuv_append(src,offset,incr,height)
unsigned char *src[];
int offset,incr,height;
{
  int hsize;
  hsize = horizontal_size;

  store_yuv1(src[0],offset,incr,hsize,height,1);

  offset>>=1; incr>>=1; hsize>>=1;
  height>>=1;

  store_yuv1(src[1],offset,incr,hsize,height,1);
  store_yuv1(src[2],offset,incr,hsize,height,1);
}

/* auxiliary routine */
static void store_yuv1(src,offset,incr,width,height,append)
unsigned char *src;
int offset,incr,width,height,append;
{
  int i, j;
  unsigned char *p;

  for (i=0; i<height; i++) {
    p = src + offset + incr*i;
    for (j=0; j<width; j++)
      *Destination ++ = *p++ ;
  }
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?