| 470 | } |
| 471 | |
| 472 | void 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. |
no outgoing calls
no test coverage detected