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

Function ff_init_block_index

libavcodec/mpegvideo.c:472–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
473 const int linesize = s->cur_pic.linesize[0]; //not s->linesize as this would be wrong for field pics
474 const int uvlinesize = s->cur_pic.linesize[1];
475 const int width_of_mb = (4 + (s->avctx->bits_per_raw_sample > 8)) - s->avctx->lowres;
476 const int height_of_mb = 4 - s->avctx->lowres;
477
478 s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2;
479 s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2;
480 s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2;
481 s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2;
482 s->block_index[4]= s->mb_stride*(s->mb_y + 1) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
483 s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
484 //block_index is not used by mpeg2, so it is not affected by chroma_format
485
486 s->dest[0] = s->cur_pic.data[0] + (int)((s->mb_x - 1U) << width_of_mb);
487 s->dest[1] = s->cur_pic.data[1] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift));
488 s->dest[2] = s->cur_pic.data[2] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift));
489
490 if (s->picture_structure == PICT_FRAME) {
491 s->dest[0] += s->mb_y * linesize << height_of_mb;
492 s->dest[1] += s->mb_y * uvlinesize << (height_of_mb - s->chroma_y_shift);
493 s->dest[2] += s->mb_y * uvlinesize << (height_of_mb - s->chroma_y_shift);
494 } else {
495 s->dest[0] += (s->mb_y>>1) * linesize << height_of_mb;
496 s->dest[1] += (s->mb_y>>1) * uvlinesize << (height_of_mb - s->chroma_y_shift);
497 s->dest[2] += (s->mb_y>>1) * uvlinesize << (height_of_mb - s->chroma_y_shift);
498 av_assert1((s->mb_y&1) == (s->picture_structure == PICT_BOTTOM_FIELD));
499 }
500}
501
502/**
503 * set qscale and update qscale dependent variables.

Callers 11

rv10_decode_packetFunction · 0.85
decode_sliceFunction · 0.85
rv34_decode_sliceFunction · 0.85
init_block_indexFunction · 0.85
h261_init_destFunction · 0.85
ff_h261_reorder_mb_indexFunction · 0.85
mpeg_decode_sliceFunction · 0.85
estimate_motion_threadFunction · 0.85
encode_threadFunction · 0.85
mpeg4_decode_partition_aFunction · 0.85
mpeg4_decode_partition_bFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected