OLD | NEW |
1 /* | 1 /* |
2 * The simplest mpeg encoder (well, it was the simplest!) | 2 * The simplest mpeg encoder (well, it was the simplest!) |
3 * Copyright (c) 2000,2001 Fabrice Bellard | 3 * Copyright (c) 2000,2001 Fabrice Bellard |
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> | 4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> |
5 * | 5 * |
6 * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at> | 6 * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at> |
7 * | 7 * |
8 * This file is part of FFmpeg. | 8 * This file is part of FFmpeg. |
9 * | 9 * |
10 * FFmpeg is free software; you can redistribute it and/or | 10 * FFmpeg is free software; you can redistribute it and/or |
11 * modify it under the terms of the GNU Lesser General Public | 11 * modify it under the terms of the GNU Lesser General Public |
12 * License as published by the Free Software Foundation; either | 12 * License as published by the Free Software Foundation; either |
13 * version 2.1 of the License, or (at your option) any later version. | 13 * version 2.1 of the License, or (at your option) any later version. |
14 * | 14 * |
15 * FFmpeg is distributed in the hope that it will be useful, | 15 * FFmpeg is distributed in the hope that it will be useful, |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 * Lesser General Public License for more details. | 18 * Lesser General Public License for more details. |
19 * | 19 * |
20 * You should have received a copy of the GNU Lesser General Public | 20 * You should have received a copy of the GNU Lesser General Public |
21 * License along with FFmpeg; if not, write to the Free Software | 21 * License along with FFmpeg; if not, write to the Free Software |
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
23 */ | 23 */ |
24 | 24 |
25 /** | 25 /** |
26 * @file libavcodec/mpegvideo.c | 26 * @file libavcodec/mpegvideo.c |
27 * The simplest mpeg encoder (well, it was the simplest!). | 27 * The simplest mpeg encoder (well, it was the simplest!). |
28 */ | 28 */ |
29 | 29 |
| 30 #include "libavutil/intmath.h" |
30 #include "avcodec.h" | 31 #include "avcodec.h" |
31 #include "dsputil.h" | 32 #include "dsputil.h" |
32 #include "mpegvideo.h" | 33 #include "mpegvideo.h" |
33 #include "mpegvideo_common.h" | 34 #include "mpegvideo_common.h" |
34 #include "mjpegenc.h" | 35 #include "mjpegenc.h" |
35 #include "msmpeg4.h" | 36 #include "msmpeg4.h" |
36 #include "faandct.h" | 37 #include "faandct.h" |
37 #include "xvmc_internal.h" | 38 #include "xvmc_internal.h" |
38 #include "thread.h" | 39 #include "thread.h" |
39 #include <limits.h> | 40 #include <limits.h> |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 252 } |
252 | 253 |
253 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mbskip_table , mb_array_size * sizeof(u
int8_t)+2, fail) //the +2 is for the slice end check | 254 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mbskip_table , mb_array_size * sizeof(u
int8_t)+2, fail) //the +2 is for the slice end check |
254 FF_ALLOCZ_OR_GOTO(s->avctx, pic->qscale_table , mb_array_size * sizeof(u
int8_t) , fail) | 255 FF_ALLOCZ_OR_GOTO(s->avctx, pic->qscale_table , mb_array_size * sizeof(u
int8_t) , fail) |
255 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_type_base , (big_mb_num + s->mb_stri
de) * sizeof(uint32_t), fail) | 256 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_type_base , (big_mb_num + s->mb_stri
de) * sizeof(uint32_t), fail) |
256 pic->mb_type= pic->mb_type_base + 2*s->mb_stride+1; | 257 pic->mb_type= pic->mb_type_base + 2*s->mb_stride+1; |
257 if(s->out_format == FMT_H264){ | 258 if(s->out_format == FMT_H264){ |
258 for(i=0; i<2; i++){ | 259 for(i=0; i<2; i++){ |
259 FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b4_arr
ay_size+4) * sizeof(int16_t), fail) | 260 FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b4_arr
ay_size+4) * sizeof(int16_t), fail) |
260 pic->motion_val[i]= pic->motion_val_base[i]+4; | 261 pic->motion_val[i]= pic->motion_val_base[i]+4; |
261 FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], b8_array_size * s
izeof(uint8_t), fail) | 262 FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], 4*mb_array_size *
sizeof(uint8_t), fail) |
262 } | 263 } |
263 pic->motion_subsample_log2= 2; | 264 pic->motion_subsample_log2= 2; |
264 }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF
_DEBUG_MV) || (s->avctx->debug_mv)){ | 265 }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF
_DEBUG_MV) || (s->avctx->debug_mv)){ |
265 for(i=0; i<2; i++){ | 266 for(i=0; i<2; i++){ |
266 FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b8_arr
ay_size+4) * sizeof(int16_t), fail) | 267 FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b8_arr
ay_size+4) * sizeof(int16_t), fail) |
267 pic->motion_val[i]= pic->motion_val_base[i]+4; | 268 pic->motion_val[i]= pic->motion_val_base[i]+4; |
268 FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], b8_array_size * s
izeof(uint8_t), fail) | 269 FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], b8_array_size * s
izeof(uint8_t), fail) |
269 } | 270 } |
270 pic->motion_subsample_log2= 3; | 271 pic->motion_subsample_log2= 3; |
271 } | 272 } |
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 | 2546 |
2546 s->y_dc_scale= s->y_dc_scale_table[ qscale ]; | 2547 s->y_dc_scale= s->y_dc_scale_table[ qscale ]; |
2547 s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ]; | 2548 s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ]; |
2548 } | 2549 } |
2549 | 2550 |
2550 void MPV_report_decode_progress(MpegEncContext *s) | 2551 void MPV_report_decode_progress(MpegEncContext *s) |
2551 { | 2552 { |
2552 if (s->pict_type != FF_B_TYPE && !s->partitioned_frame) | 2553 if (s->pict_type != FF_B_TYPE && !s->partitioned_frame) |
2553 ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0); | 2554 ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0); |
2554 } | 2555 } |
OLD | NEW |