Mercurial > libavcodec.hg
comparison mpegvideo.c @ 3245:c2c29be6282e libavcodec
remove mpegvideo.c img resample dependancy
author | michael |
---|---|
date | Fri, 31 Mar 2006 20:43:37 +0000 |
parents | 4186eb8d29a1 |
children | f7a9d8dd476b |
comparison
equal
deleted
inserted
replaced
3244:b9a0ca749833 | 3245:c2c29be6282e |
---|---|
2178 AVFrame input[FF_MAX_B_FRAMES+2]; | 2178 AVFrame input[FF_MAX_B_FRAMES+2]; |
2179 const int scale= s->avctx->brd_scale; | 2179 const int scale= s->avctx->brd_scale; |
2180 int i, j, out_size, p_lambda, b_lambda, lambda2; | 2180 int i, j, out_size, p_lambda, b_lambda, lambda2; |
2181 int outbuf_size= s->width * s->height; //FIXME | 2181 int outbuf_size= s->width * s->height; //FIXME |
2182 uint8_t *outbuf= av_malloc(outbuf_size); | 2182 uint8_t *outbuf= av_malloc(outbuf_size); |
2183 ImgReSampleContext *resample; | |
2184 int64_t best_rd= INT64_MAX; | 2183 int64_t best_rd= INT64_MAX; |
2185 int best_b_count= -1; | 2184 int best_b_count= -1; |
2185 | |
2186 assert(scale>=0 && scale <=3); | |
2186 | 2187 |
2187 // emms_c(); | 2188 // emms_c(); |
2188 p_lambda= s->last_lambda_for[P_TYPE]; //s->next_picture_ptr->quality; | 2189 p_lambda= s->last_lambda_for[P_TYPE]; //s->next_picture_ptr->quality; |
2189 b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *ABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; | 2190 b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *ABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; |
2190 if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else | 2191 if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else |
2203 c->max_b_frames= s->max_b_frames; | 2204 c->max_b_frames= s->max_b_frames; |
2204 | 2205 |
2205 if (avcodec_open(c, codec) < 0) | 2206 if (avcodec_open(c, codec) < 0) |
2206 return -1; | 2207 return -1; |
2207 | 2208 |
2208 resample= img_resample_init(c->width, c->height, s->width, s->height); //FIXME use sws | |
2209 | |
2210 for(i=0; i<s->max_b_frames+2; i++){ | 2209 for(i=0; i<s->max_b_frames+2; i++){ |
2211 int ysize= c->width*c->height; | 2210 int ysize= c->width*c->height; |
2212 int csize= (c->width/2)*(c->height/2); | 2211 int csize= (c->width/2)*(c->height/2); |
2213 Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr; | 2212 Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr; |
2214 | 2213 |
2227 input[i].data[2]= input[i].data[1] + csize; | 2226 input[i].data[2]= input[i].data[1] + csize; |
2228 input[i].linesize[0]= c->width; | 2227 input[i].linesize[0]= c->width; |
2229 input[i].linesize[1]= | 2228 input[i].linesize[1]= |
2230 input[i].linesize[2]= c->width/2; | 2229 input[i].linesize[2]= c->width/2; |
2231 | 2230 |
2232 if(!i || s->input_picture[i-1]) | 2231 if(!i || s->input_picture[i-1]){ |
2233 img_resample(resample, (AVPicture*)&input[i], | 2232 s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height); |
2234 (AVPicture*)&pre_input); | 2233 s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1); |
2234 s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1); | |
2235 } | |
2235 } | 2236 } |
2236 | 2237 |
2237 for(j=0; j<s->max_b_frames+1; j++){ | 2238 for(j=0; j<s->max_b_frames+1; j++){ |
2238 int64_t rd=0; | 2239 int64_t rd=0; |
2239 | 2240 |
2271 } | 2272 } |
2272 | 2273 |
2273 av_freep(&outbuf); | 2274 av_freep(&outbuf); |
2274 avcodec_close(c); | 2275 avcodec_close(c); |
2275 av_freep(&c); | 2276 av_freep(&c); |
2276 img_resample_close(resample); | |
2277 | 2277 |
2278 for(i=0; i<s->max_b_frames+2; i++){ | 2278 for(i=0; i<s->max_b_frames+2; i++){ |
2279 av_freep(&input[i].data[0]); | 2279 av_freep(&input[i].data[0]); |
2280 } | 2280 } |
2281 | 2281 |