0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

ffhuffyuv

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8191 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
michael 2002-11-14 19:27:51 +00:00
parent 2e30fba268
commit eb2caba06c
3 changed files with 59 additions and 4 deletions

View File

@ -230,6 +230,15 @@ videocodec cvidxa
; time to decide what to do with the mpeg4/divx variants...
; ff* is fastest...
videocodec ffhuffyuv
info "FFHuffYUV"
status working
fourcc HFYU
driver ffmpeg
dll huffyuv
out YV12,YUY2,422P
out BGR32,BGR24
videocodec ffsvq1
info "FFmpeg Sorenson Video v1"
status working

View File

@ -236,6 +236,7 @@ static int init(sh_video_t *sh){
if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) &&
(sh->format == mmioFOURCC('M','4','S','2') ||
sh->format == mmioFOURCC('M','P','4','S') ||
sh->format == mmioFOURCC('H','F','Y','U') ||
sh->format == mmioFOURCC('W','M','V','2')
))
{
@ -243,6 +244,10 @@ static int init(sh_video_t *sh){
avctx->extradata = malloc(avctx->extradata_size);
memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
}
#if LIBAVCODEC_BUILD >= 4639
avctx->bits_per_sample= sh->bih->biBitCount;
#endif
/* open it */
if (avcodec_open(avctx, lavc_codec) < 0) {
@ -361,12 +366,14 @@ static int init_vo(sh_video_t *sh){
case PIX_FMT_YUV410P: ctx->best_csp=IMGFMT_YVU9;break; //svq1
#endif
case PIX_FMT_YUV420P: ctx->best_csp=IMGFMT_YV12;break; //mpegs
case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg
case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg / huffyuv
case PIX_FMT_YUV444P: ctx->best_csp=IMGFMT_444P;break; //???
#if LIBAVCODEC_BUILD >= 4631
case PIX_FMT_YUV411P: ctx->best_csp=IMGFMT_411P;break; //dv ntsc
#endif
case PIX_FMT_YUV422: ctx->best_csp=IMGFMT_YUY2;break; //???
case PIX_FMT_YUV422: ctx->best_csp=IMGFMT_YUY2;break; //huffyuv perhaps in the future
case PIX_FMT_BGR24 : ctx->best_csp=IMGFMT_BGR24;break; //huffyuv
case PIX_FMT_BGRA32: ctx->best_csp=IMGFMT_BGR32;break; //huffyuv
default:
ctx->best_csp=0;
}

View File

@ -92,6 +92,8 @@ static float lavc_param_spatial_cplx_masking= 0.0;
static float lavc_param_p_masking= 0.0;
static int lavc_param_normalize_aqp= 0;
static int lavc_param_interlaced_dct= 0;
static int lavc_param_prediction_method= FF_PRED_LEFT;
static char *lavc_param_format="YV12";
#include "cfgparser.h"
@ -166,6 +168,10 @@ struct config lavcopts_conf[]={
#endif
#if LIBAVCODEC_BUILD >= 4629
{"idct", &lavc_param_idct, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL},
#endif
#if LIBAVCODEC_BUILD >= 4639
{"pred", &lavc_param_prediction_method, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL},
{"format", &lavc_param_format, CONF_TYPE_STRING, 0, 0, 0, NULL},
#endif
{NULL, NULL, 0, 0, 0, 0, NULL}
};
@ -341,7 +347,17 @@ static int config(struct vf_instance_s* vf,
#if LIBAVCODEC_BUILD >= 4627
if(lavc_param_interlaced_dct) lavc_venc_context->flags|= CODEC_FLAG_INTERLACED_DCT;
#endif
#if LIBAVCODEC_BUILD >= 4639
lavc_venc_context->prediction_method= lavc_param_prediction_method;
if(!strcasecmp(lavc_param_format, "YV12"))
lavc_venc_context->pix_fmt= PIX_FMT_YUV420P;
else if(!strcasecmp(lavc_param_format, "422P"))
lavc_venc_context->pix_fmt= PIX_FMT_YUV422P;
else{
mp_msg(MSGT_MENCODER,MSGL_ERR,"%s is not a supported format\n", lavc_param_format);
return 0;
}
#endif
/* lavc internal 2pass bitrate control */
switch(lavc_param_vpass){
case 1:
@ -407,6 +423,14 @@ static int config(struct vf_instance_s* vf,
if(lavc_venc_context->stats_in) free(lavc_venc_context->stats_in);
lavc_venc_context->stats_in= NULL;
#endif
#if LIBAVCODEC_BUILD >= 4639
if(lavc_venc_context->bits_per_sample)
mux_v->bih->biBitCount= lavc_venc_context->bits_per_sample;
if(lavc_venc_context->extradata_size){
memcpy(mux_v->bih + 1, lavc_venc_context->extradata, lavc_venc_context->extradata_size);
mux_v->bih->biSize= sizeof(BITMAPINFOHEADER) + lavc_venc_context->extradata_size;
}
#endif
return 1;
}
@ -421,7 +445,13 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
case IMGFMT_YV12:
case IMGFMT_IYUV:
case IMGFMT_I420:
return VFCAP_CSP_SUPPORTED | VFCAP_ACCEPT_STRIDE;
if(!strcasecmp(lavc_param_format, "YV12"))
return VFCAP_CSP_SUPPORTED | VFCAP_ACCEPT_STRIDE;
break;
case IMGFMT_422P:
if(!strcasecmp(lavc_param_format, "422P"))
return VFCAP_CSP_SUPPORTED | VFCAP_ACCEPT_STRIDE;
break;
}
return 0;
}
@ -486,6 +516,13 @@ static int vf_open(vf_instance_t *vf, char* args){
memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+28);
mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+28;
}
else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "huffyuv"))
{
/* XXX: hack: huffyuv needs to store huffman tables (allthough we dunno the size yet ...) */
mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+1000);
memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+1000);
mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+1000;
}
else
{
mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
@ -518,6 +555,8 @@ static int vf_open(vf_instance_t *vf, char* args){
mux_v->bih->biCompression = mmioFOURCC('M', 'P', '4', '2');
else if (!strcasecmp(lavc_param_vcodec, "wmv1"))
mux_v->bih->biCompression = mmioFOURCC('W', 'M', 'V', '1');
else if (!strcasecmp(lavc_param_vcodec, "huffyuv"))
mux_v->bih->biCompression = mmioFOURCC('H', 'F', 'Y', 'U');
else
mux_v->bih->biCompression = mmioFOURCC(lavc_param_vcodec[0],
lavc_param_vcodec[1], lavc_param_vcodec[2], lavc_param_vcodec[3]); /* FIXME!!! */