MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / encode_thread

Function encode_thread

libavcodec/mpegvideo_enc.c:2038–2666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2036}
2037
2038static int encode_thread(AVCodecContext *c, void *arg){
2039 MpegEncContext *s= *(void**)arg;
2040 int mb_x, mb_y, pdif = 0;
2041 int chr_h= 16>>s->chroma_y_shift;
2042 int i, j;
2043 MpegEncContext best_s, backup_s;
2044 uint8_t bit_buf[2][MAX_MB_BYTES];
2045 uint8_t bit_buf2[2][MAX_MB_BYTES];
2046 uint8_t bit_buf_tex[2][MAX_MB_BYTES];
2047 PutBitContext pb[2], pb2[2], tex_pb[2];
2048//printf("%d->%d\n", s->resync_mb_y, s->end_mb_y);
2049
2050 ff_check_alignment();
2051
2052 for(i=0; i<2; i++){
2053 init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES);
2054 init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES);
2055 init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES);
2056 }
2057
2058 s->last_bits= put_bits_count(&s->pb);
2059 s->mv_bits=0;
2060 s->misc_bits=0;
2061 s->i_tex_bits=0;
2062 s->p_tex_bits=0;
2063 s->i_count=0;
2064 s->f_count=0;
2065 s->b_count=0;
2066 s->skip_count=0;
2067
2068 for(i=0; i<3; i++){
2069 /* init last dc values */
2070 /* note: quant matrix value (8) is implied here */
2071 s->last_dc[i] = 128 << s->intra_dc_precision;
2072
2073 s->current_picture.error[i] = 0;
2074 }
2075 s->mb_skip_run = 0;
2076 memset(s->last_mv, 0, sizeof(s->last_mv));
2077
2078 s->last_mv_dir = 0;
2079
2080 switch(s->codec_id){
2081 case CODEC_ID_H263:
2082 case CODEC_ID_H263P:
2083 case CODEC_ID_FLV1:
2084 if (CONFIG_H263_ENCODER)
2085 s->gob_index = ff_h263_get_gob_height(s);
2086 break;
2087 case CODEC_ID_MPEG4:
2088 if(CONFIG_MPEG4_ENCODER && s->partitioned_frame)
2089 ff_mpeg4_init_partitions(s);
2090 break;
2091 }
2092
2093 s->resync_mb_x=0;
2094 s->resync_mb_y=0;
2095 s->first_slice_line = 1;

Callers

nothing calls this directly

Calls 15

ff_check_alignmentFunction · 0.85
init_put_bitsFunction · 0.85
put_bits_countFunction · 0.85
ff_h263_get_gob_heightFunction · 0.85
ff_mpeg4_init_partitionsFunction · 0.85
ff_set_qscaleFunction · 0.85
ff_init_block_indexFunction · 0.85
av_logFunction · 0.85
ff_update_block_indexFunction · 0.85
ff_h261_reorder_mb_indexFunction · 0.85
write_slice_endFunction · 0.85
put_bits_ptrFunction · 0.85

Tested by

no test coverage detected