[Mplayer-cvslog] CVS: main/libmpcodecs vf_lavc.c,1.9,1.10 ve_lavc.c,1.45,1.46 vd_ffmpeg.c,1.77,1.78
Michael Niedermayer CVS
michael at mplayerhq.hu
Mon Dec 9 13:36:25 CET 2002
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv27869
Modified Files:
vf_lavc.c ve_lavc.c vd_ffmpeg.c
Log Message:
AVVideoFrame -> AVFrame
Index: vf_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_lavc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- vf_lavc.c 4 Dec 2002 11:53:47 -0000 1.9
+++ vf_lavc.c 9 Dec 2002 12:36:04 -0000 1.10
@@ -25,13 +25,22 @@
#error we dont support libavcodec prior to build 4641, get the latest libavcodec CVS
#endif
+#if LIBAVCODEC_BUILD < 4645
+#warning your version of libavcodec is old, u might want to get a newer one
+#endif
+
+#if LIBAVCODEC_BUILD < 4645
+#define AVFrame AVVideoFrame
+#define coded_frame coded_picture
+#endif
+
extern int avcodec_inited;
struct vf_priv_s {
unsigned char* outbuf;
int outbuf_size;
AVCodecContext* context;
- AVVideoFrame* pic;
+ AVFrame* pic;
AVCodec* codec;
vo_mpegpes_t pes;
};
@@ -85,7 +94,7 @@
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
mp_image_t* dmpi;
int out_size;
- AVVideoFrame *pic= vf->priv->pic;
+ AVFrame *pic= vf->priv->pic;
pic->data[0]=mpi->planes[0];
pic->data[1]=mpi->planes[1];
@@ -148,7 +157,11 @@
}
vf->priv->context=avcodec_alloc_context();
- vf->priv->pic=avcodec_alloc_picture();
+#if LIBAVCODEC_BUILD >= 4645
+ vf->priv->pic = avcodec_alloc_frame();
+#else
+ vf->priv->pic = avcodec_alloc_picture();
+#endif
// TODO: parse args ->
if(args) sscanf(args, "%d:%f", &p_quality, &p_fps);
Index: ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- ve_lavc.c 5 Dec 2002 09:13:29 -0000 1.45
+++ ve_lavc.c 9 Dec 2002 12:36:04 -0000 1.46
@@ -41,10 +41,15 @@
#error we dont support libavcodec prior to build 4641, get the latest libavcodec CVS
#endif
-#if LIBAVCODEC_BUILD < 4624
+#if LIBAVCODEC_BUILD < 4645
#warning your version of libavcodec is old, u might want to get a newer one
#endif
+#if LIBAVCODEC_BUILD < 4645
+#define AVFrame AVVideoFrame
+#define coded_frame coded_picture
+#endif
+
extern int avcodec_inited;
/* video options */
@@ -121,7 +126,7 @@
{"vmax_b_frames", &lavc_param_vmax_b_frames, CONF_TYPE_INT, CONF_RANGE, 0, FF_MAX_B_FRAMES, NULL},
{"vpass", &lavc_param_vpass, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
{"vrc_strategy", &lavc_param_vrc_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
- {"vb_strategy", &lavc_param_vb_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL},
+ {"vb_strategy", &lavc_param_vb_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL},
{"vb_qoffset", &lavc_param_vb_qoffset, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 31.0, NULL},
{"vlelim", &lavc_param_luma_elim_threshold, CONF_TYPE_INT, CONF_RANGE, -99, 99, NULL},
{"vcelim", &lavc_param_chroma_elim_threshold, CONF_TYPE_INT, CONF_RANGE, -99, 99, NULL},
@@ -168,7 +173,7 @@
struct vf_priv_s {
aviwrite_stream_t* mux;
AVCodecContext *context;
- AVVideoFrame *pic;
+ AVFrame *pic;
AVCodec *codec;
FILE *stats_file;
};
@@ -420,7 +425,7 @@
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
const char pict_type_char[5]= {'?', 'I', 'P', 'B', 'S'};
int out_size;
- AVVideoFrame *pic= vf->priv->pic;
+ AVFrame *pic= vf->priv->pic;
pic->data[0]=mpi->planes[0];
pic->data[1]=mpi->planes[1];
@@ -432,8 +437,8 @@
out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size,
pic);
- mencoder_write_chunk(mux_v,out_size,lavc_venc_context->coded_picture->key_frame?0x10:0);
-
+ mencoder_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0);
+
#if LIBAVCODEC_BUILD >= 4643
/* store psnr / pict size / type / qscale */
if(lavc_param_psnr){
@@ -442,7 +447,7 @@
static long long int all_len=0;
static int frame_number=0;
static double all_frametime=0.0;
- AVVideoFrame *pic= lavc_venc_context->coded_picture;
+ AVFrame *pic= lavc_venc_context->coded_frame;
double f= lavc_venc_context->width*lavc_venc_context->height*255.0*255.0;
if(!fvstats) {
@@ -461,14 +466,14 @@
}
fprintf(fvstats, "%6d, %2.2f, %6d, %2.2f, %2.2f, %2.2f, %2.2f %c\n",
- lavc_venc_context->coded_picture->coded_picture_number,
- lavc_venc_context->coded_picture->quality,
+ lavc_venc_context->coded_frame->coded_picture_number,
+ lavc_venc_context->coded_frame->quality,
out_size,
- psnr(lavc_venc_context->coded_picture->error[0]/f),
- psnr(lavc_venc_context->coded_picture->error[1]*4/f),
- psnr(lavc_venc_context->coded_picture->error[2]*4/f),
- psnr((lavc_venc_context->coded_picture->error[0]+lavc_venc_context->coded_picture->error[1]+lavc_venc_context->coded_picture->error[2])/(f*1.5)),
- pict_type_char[lavc_venc_context->coded_picture->pict_type]
+ psnr(lavc_venc_context->coded_frame->error[0]/f),
+ psnr(lavc_venc_context->coded_frame->error[1]*4/f),
+ psnr(lavc_venc_context->coded_frame->error[2]*4/f),
+ psnr((lavc_venc_context->coded_frame->error[0]+lavc_venc_context->coded_frame->error[1]+lavc_venc_context->coded_frame->error[2])/(f*1.5)),
+ pict_type_char[lavc_venc_context->coded_frame->pict_type]
);
}
#endif
@@ -485,7 +490,7 @@
if(lavc_param_psnr){
double f= lavc_venc_context->width*lavc_venc_context->height*255.0*255.0;
- f*= lavc_venc_context->coded_picture->coded_picture_number;
+ f*= lavc_venc_context->coded_frame->coded_picture_number;
printf("PSNR: Y:%2.2f, Cb:%2.2f, Cr:%2.2f, All:%2.2f\n",
psnr(lavc_venc_context->error[0]/f),
@@ -586,7 +591,11 @@
return 0;
}
+#if LIBAVCODEC_BUILD >= 4645
+ vf->priv->pic = avcodec_alloc_frame();
+#else
vf->priv->pic = avcodec_alloc_picture();
+#endif
vf->priv->context = avcodec_alloc_context();
return 1;
Index: vd_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- vd_ffmpeg.c 9 Dec 2002 09:12:23 -0000 1.77
+++ vd_ffmpeg.c 9 Dec 2002 12:36:04 -0000 1.78
@@ -36,6 +36,15 @@
#error we dont support libavcodec prior to build 4641, get the latest libavcodec CVS
#endif
+#if LIBAVCODEC_BUILD < 4645
+#warning your version of libavcodec is old, u might want to get a newer one
+#endif
+
+#if LIBAVCODEC_BUILD < 4645
+#define AVFrame AVVideoFrame
+#define coded_frame coded_picture
+#endif
+
int avcodec_inited=0;
#if defined(FF_POSTPROCESS) && defined(MBR)
@@ -44,7 +53,7 @@
typedef struct {
AVCodecContext *avctx;
- AVVideoFrame *pic;
+ AVFrame *pic;
float last_aspect;
int do_slices;
int do_dr1;
@@ -64,8 +73,8 @@
#include "cfgparser.h"
-static int get_buffer(AVCodecContext *avctx, AVVideoFrame *pic);
-static void release_buffer(AVCodecContext *avctx, AVVideoFrame *pic);
+static int get_buffer(AVCodecContext *avctx, AVFrame *pic);
+static void release_buffer(AVCodecContext *avctx, AVFrame *pic);
static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT;
static int lavc_param_error_resilience=2;
@@ -149,7 +158,11 @@
ctx->do_dr1=0;
ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64;
+#if LIBAVCODEC_BUILD >= 4645
+ ctx->pic = avcodec_alloc_frame();
+#else
ctx->pic = avcodec_alloc_picture();
+#endif
ctx->avctx = avcodec_alloc_context();
avctx = ctx->avctx;
@@ -255,8 +268,8 @@
printf("QP: %d, count: %d\n", i, ctx->qp_stat[i]);
}
printf("Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n",
- ctx->qp_sum / avctx->coded_picture->coded_picture_number,
- 1.0/(ctx->inv_qp_sum / avctx->coded_picture->coded_picture_number)
+ ctx->qp_sum / avctx->coded_frame->coded_picture_number,
+ 1.0/(ctx->inv_qp_sum / avctx->coded_frame->coded_picture_number)
);
}
@@ -285,13 +298,13 @@
int stride[3];
int start=0, i;
int skip_stride= (s->width+15)>>4;
- UINT8 *skip= &s->coded_picture->mbskip_table[(y>>4)*skip_stride];
- int threshold= s->coded_picture->age;
+ UINT8 *skip= &s->coded_frame->mbskip_table[(y>>4)*skip_stride];
+ int threshold= s->coded_frame->age;
stride[0]=linesize;
- if(s->coded_picture->linesize[1]){
- stride[1]= s->coded_picture->linesize[1];
- stride[2]= s->coded_picture->linesize[2];
+ if(s->coded_frame->linesize[1]){
+ stride[1]= s->coded_frame->linesize[1];
+ stride[2]= s->coded_frame->linesize[2];
}else
stride[1]=stride[2]=stride[0]/2;
#if 0
@@ -349,7 +362,7 @@
return 0;
}
-static int get_buffer(AVCodecContext *avctx, AVVideoFrame *pic){
+static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
sh_video_t * sh = avctx->opaque;
vd_ffmpeg_ctx *ctx = sh->context;
mp_image_t* mpi=NULL;
@@ -449,7 +462,7 @@
return 0;
}
-static void release_buffer(struct AVCodecContext *avctx, AVVideoFrame *pic){
+static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){
int i;
#if LIBAVCODEC_BUILD >= 4644
@@ -476,7 +489,7 @@
int got_picture=0;
int ret;
vd_ffmpeg_ctx *ctx = sh->context;
- AVVideoFrame *pic= ctx->pic;
+ AVFrame *pic= ctx->pic;
AVCodecContext *avctx = ctx->avctx;
mp_image_t* mpi=NULL;
int dr1= ctx->do_dr1;
@@ -528,7 +541,7 @@
static long long int all_len=0;
static int frame_number=0;
static double all_frametime=0.0;
- AVVideoFrame *pic= avctx->coded_picture;
+ AVFrame *pic= avctx->coded_frame;
if(!fvstats) {
time_t today2;
More information about the MPlayer-cvslog
mailing list