common.c

来自「decode the h264 video」· C语言 代码 · 共 24 行

C
24
字号
#include "common.h"#include "params.h"#include "main.h"frame *alloc_frame(int width, int height) {  frame *f=calloc(1,sizeof(frame));  f->Lwidth=f->Lpitch=width;  f->Lheight=height;  f->L=malloc(width*height);  f->Cwidth=f->Cpitch=width>>1;  f->Cheight=height>>1;  f->C[0]=malloc(width*height/4);  f->C[1]=malloc(width*height/4);  return f;}void free_frame(frame *f) {  if(!f) return;  if(f->L) free(f->L);  if(f->C[0]) free(f->C[0]);  if(f->C[0]) free(f->C[1]);  free(f);}

⌨️ 快捷键说明

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