comparison mpegvideo.h @ 1799:95612d423fde libavcodec

multithreaded/SMP motion estimation multithreaded/SMP encoding for MPEG1/MPEG2/MPEG4/H263 all pthread specific code is in pthread.c to try it, run configure --enable-pthreads and ffmpeg ... -threads <num> the internal thread API is a simple AVCodecContext.execute() callback which executes a given function pointer with different arguments and returns after finishing all, that way no mutexes or other thread-mess is needed outside pthread.c
author michael
date Fri, 13 Feb 2004 17:54:10 +0000
parents b7340afa261a
children fcbf31baa1af
comparison
equal deleted inserted replaced
1798:a3da4b429984 1799:95612d423fde
44 #define QMAT_SHIFT_MMX 16 44 #define QMAT_SHIFT_MMX 16
45 #define QMAT_SHIFT 22 45 #define QMAT_SHIFT 22
46 46
47 #define MAX_FCODE 7 47 #define MAX_FCODE 7
48 #define MAX_MV 2048 48 #define MAX_MV 2048
49
50 #define MAX_THREADS 8
49 51
50 #define MAX_PICTURE_COUNT 15 52 #define MAX_PICTURE_COUNT 15
51 53
52 #define ME_MAP_SIZE 64 54 #define ME_MAP_SIZE 64
53 #define ME_MAP_SHIFT 3 55 #define ME_MAP_SHIFT 3
283 int uvlinesize; ///< line size, for chroma in bytes, may be different from width 285 int uvlinesize; ///< line size, for chroma in bytes, may be different from width
284 Picture *picture; ///< main picture buffer 286 Picture *picture; ///< main picture buffer
285 Picture **input_picture; ///< next pictures on display order for encoding 287 Picture **input_picture; ///< next pictures on display order for encoding
286 Picture **reordered_input_picture; ///< pointer to the next pictures in codedorder for encoding 288 Picture **reordered_input_picture; ///< pointer to the next pictures in codedorder for encoding
287 289
290 int start_mb_y; ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
291 int end_mb_y; ///< end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
292 struct MpegEncContext *thread_context[MAX_THREADS];
293
288 /** 294 /**
289 * copy of the previous picture structure. 295 * copy of the previous picture structure.
290 * note, linesize & data, might not match the previous picture (for field pictures) 296 * note, linesize & data, might not match the previous picture (for field pictures)
291 */ 297 */
292 Picture last_picture; 298 Picture last_picture;
330 and used for b-frame encoding & decoding (contains skip table of next P Frame) */ 336 and used for b-frame encoding & decoding (contains skip table of next P Frame) */
331 uint8_t *mbintra_table; ///< used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding 337 uint8_t *mbintra_table; ///< used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
332 uint8_t *cbp_table; ///< used to store cbp, ac_pred for partitioned decoding 338 uint8_t *cbp_table; ///< used to store cbp, ac_pred for partitioned decoding
333 uint8_t *pred_dir_table; ///< used to store pred_dir for partitioned decoding 339 uint8_t *pred_dir_table; ///< used to store pred_dir for partitioned decoding
334 uint8_t *allocated_edge_emu_buffer; 340 uint8_t *allocated_edge_emu_buffer;
335 uint8_t *edge_emu_buffer; ///< points into the middle of allocated_edge_emu_buffer 341 uint8_t *edge_emu_buffer; ///< points into the middle of allocated_edge_emu_buffer
342 uint8_t *rd_scratchpad; ///< scartchpad for rate distortion mb decission
343 uint8_t *obmc_scratchpad;
344 uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers
336 345
337 int qscale; ///< QP 346 int qscale; ///< QP
338 int chroma_qscale; ///< chroma QP 347 int chroma_qscale; ///< chroma QP
339 int lambda; ///< lagrange multipler used in rate distortion 348 int lambda; ///< lagrange multipler used in rate distortion
340 int lambda2; ///< (lambda*lambda) >> FF_LAMBDA_SHIFT 349 int lambda2; ///< (lambda*lambda) >> FF_LAMBDA_SHIFT
485 int b_count; 494 int b_count;
486 int skip_count; 495 int skip_count;
487 int misc_bits; ///< cbp, mb_type 496 int misc_bits; ///< cbp, mb_type
488 int last_bits; ///< temp var used for calculating the above vars 497 int last_bits; ///< temp var used for calculating the above vars
489 498
499 /* temp variables for picture complexity calculation */
500 int mc_mb_var_sum_temp;
501 int mb_var_sum_temp;
502
490 /* error concealment / resync */ 503 /* error concealment / resync */
491 int error_count; 504 int error_count;
492 uint8_t *error_status_table; ///< table of the error status of each MB 505 uint8_t *error_status_table; ///< table of the error status of each MB
493 #define VP_START 1 ///< current MB is the first after a resync marker 506 #define VP_START 1 ///< current MB is the first after a resync marker
494 #define AC_ERROR 2 507 #define AC_ERROR 2
563 int vo_type; 576 int vo_type;
564 int vol_control_parameters; ///< does the stream contain the low_delay flag, used to workaround buggy encoders 577 int vol_control_parameters; ///< does the stream contain the low_delay flag, used to workaround buggy encoders
565 int intra_dc_threshold; ///< QP above whch the ac VLC should be used for intra dc 578 int intra_dc_threshold; ///< QP above whch the ac VLC should be used for intra dc
566 PutBitContext tex_pb; ///< used for data partitioned VOPs 579 PutBitContext tex_pb; ///< used for data partitioned VOPs
567 PutBitContext pb2; ///< used for data partitioned VOPs 580 PutBitContext pb2; ///< used for data partitioned VOPs
568 #define PB_BUFFER_SIZE 1024*256
569 uint8_t *tex_pb_buffer;
570 uint8_t *pb2_buffer;
571 int mpeg_quant; 581 int mpeg_quant;
572 int t_frame; ///< time distance of first I -> B, used for interlaced b frames 582 int t_frame; ///< time distance of first I -> B, used for interlaced b frames
573 int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG4 583 int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG4
574 584
575 /* divx specific, used to workaround (many) bugs in divx5 */ 585 /* divx specific, used to workaround (many) bugs in divx5 */
906 void mjpeg_close(MpegEncContext *s); 916 void mjpeg_close(MpegEncContext *s);
907 void mjpeg_encode_mb(MpegEncContext *s, 917 void mjpeg_encode_mb(MpegEncContext *s,
908 DCTELEM block[6][64]); 918 DCTELEM block[6][64]);
909 void mjpeg_picture_header(MpegEncContext *s); 919 void mjpeg_picture_header(MpegEncContext *s);
910 void mjpeg_picture_trailer(MpegEncContext *s); 920 void mjpeg_picture_trailer(MpegEncContext *s);
921 void ff_mjpeg_stuffing(PutBitContext * pbc);
911 922
912 923
913 /* rate control */ 924 /* rate control */
914 int ff_rate_control_init(MpegEncContext *s); 925 int ff_rate_control_init(MpegEncContext *s);
915 float ff_rate_estimate_qscale(MpegEncContext *s); 926 float ff_rate_estimate_qscale(MpegEncContext *s);