comparison mpeg12.c @ 2270:21f450be6cb5 libavcodec

lowres width/height cleanup 3rd try
author michael
date Mon, 27 Sep 2004 11:50:56 +0000
parents 514949de5d15
children 857e16e85aea
comparison
equal deleted inserted replaced
2269:535b7dfee202 2270:21f450be6cb5
1964 MpegEncContext *s = &s1->mpeg_enc_ctx; 1964 MpegEncContext *s = &s1->mpeg_enc_ctx;
1965 uint8_t old_permutation[64]; 1965 uint8_t old_permutation[64];
1966 1966
1967 if ( 1967 if (
1968 (s1->mpeg_enc_ctx_allocated == 0)|| 1968 (s1->mpeg_enc_ctx_allocated == 0)||
1969 avctx->width != -((-s->width )>>avctx->lowres) || 1969 avctx->coded_width != s->width ||
1970 avctx->height != -((-s->height)>>avctx->lowres) || 1970 avctx->coded_height != s->height||
1971 // s1->save_aspect_info != avctx->aspect_ratio_info|| 1971 // s1->save_aspect_info != avctx->aspect_ratio_info||
1972 0) 1972 0)
1973 { 1973 {
1974 1974
1975 if (s1->mpeg_enc_ctx_allocated) { 1975 if (s1->mpeg_enc_ctx_allocated) {
1977 } 1977 }
1978 1978
1979 if( (s->width == 0 )||(s->height == 0)) 1979 if( (s->width == 0 )||(s->height == 0))
1980 return -2; 1980 return -2;
1981 1981
1982 avctx->width = -((-s->width )>>avctx->lowres); 1982 avcodec_set_dimensions(avctx, s->width, s->height);
1983 avctx->height = -((-s->height)>>avctx->lowres);
1984 avctx->bit_rate = s->bit_rate; 1983 avctx->bit_rate = s->bit_rate;
1985 s1->save_aspect_info = s->aspect_ratio_info; 1984 s1->save_aspect_info = s->aspect_ratio_info;
1986 1985
1987 //low_delay may be forced, in this case we will have B frames 1986 //low_delay may be forced, in this case we will have B frames
1988 //that behave like P frames 1987 //that behave like P frames
2774 /* start new mpeg1 context decoding */ 2773 /* start new mpeg1 context decoding */
2775 s->out_format = FMT_MPEG1; 2774 s->out_format = FMT_MPEG1;
2776 if (s1->mpeg_enc_ctx_allocated) { 2775 if (s1->mpeg_enc_ctx_allocated) {
2777 MPV_common_end(s); 2776 MPV_common_end(s);
2778 } 2777 }
2779 s->width = avctx->width; 2778 s->width = avctx->coded_width;
2780 s->height = avctx->height; 2779 s->height = avctx->coded_height;
2781 avctx->has_b_frames= 0; //true? 2780 avctx->has_b_frames= 0; //true?
2782 s->low_delay= 1; 2781 s->low_delay= 1;
2783 2782
2784 if(avctx->xvmc_acceleration){ 2783 if(avctx->xvmc_acceleration){
2785 avctx->pix_fmt = avctx->get_format(avctx,pixfmt_xvmc_mpg2_420); 2784 avctx->pix_fmt = avctx->get_format(avctx,pixfmt_xvmc_mpg2_420);