42
42
int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
46
* The pixels are allocated/set by calling get_buffer() if shared=0
46
* The pixels are allocated/set by calling get_buffer() if shared = 0.
48
48
int alloc_picture(MpegEncContext *s, Picture *pic, int shared);
51
* sets the given MpegEncContext to common defaults (same for encoding and decoding).
52
* the changed fields will not depend upon the prior state of the MpegEncContext.
51
* Set the given MpegEncContext to common defaults (same for encoding and decoding).
52
* The changed fields will not depend upon the prior state of the MpegEncContext.
54
54
void MPV_common_defaults(MpegEncContext *s);
257
257
v_edge_pos = s->v_edge_pos >> field_based;
258
linesize = s->current_picture.linesize[0] << field_based;
259
uvlinesize = s->current_picture.linesize[1] << field_based;
258
linesize = s->current_picture.f.linesize[0] << field_based;
259
uvlinesize = s->current_picture.f.linesize[1] << field_based;
261
261
dxy = ((motion_y & 1) << 1) | (motion_x & 1);
262
262
src_x = s->mb_x* 16 + (motion_x >> 1);
585
585
if (src_y == (s->height >> 1))
588
offset = (src_y * (s->uvlinesize)) + src_x;
588
offset = src_y * s->uvlinesize + src_x;
589
589
ptr = ref_picture[1] + offset;
590
590
if(s->flags&CODEC_FLAG_EMU_EDGE){
591
591
if( (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8
658
658
assert(!s->mb_skipped);
660
memcpy(mv_cache[1][1], s->current_picture.motion_val[0][mot_xy ], sizeof(int16_t)*4);
661
memcpy(mv_cache[2][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
662
memcpy(mv_cache[3][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
660
memcpy(mv_cache[1][1], s->current_picture.f.motion_val[0][mot_xy ], sizeof(int16_t) * 4);
661
memcpy(mv_cache[2][1], s->current_picture.f.motion_val[0][mot_xy + mot_stride], sizeof(int16_t) * 4);
662
memcpy(mv_cache[3][1], s->current_picture.f.motion_val[0][mot_xy + mot_stride], sizeof(int16_t) * 4);
664
if(mb_y==0 || IS_INTRA(s->current_picture.mb_type[xy-s->mb_stride])){
664
if (mb_y == 0 || IS_INTRA(s->current_picture.f.mb_type[xy - s->mb_stride])) {
665
665
memcpy(mv_cache[0][1], mv_cache[1][1], sizeof(int16_t)*4);
667
memcpy(mv_cache[0][1], s->current_picture.motion_val[0][mot_xy-mot_stride], sizeof(int16_t)*4);
667
memcpy(mv_cache[0][1], s->current_picture.f.motion_val[0][mot_xy - mot_stride], sizeof(int16_t) * 4);
670
if(mb_x==0 || IS_INTRA(s->current_picture.mb_type[xy-1])){
670
if (mb_x == 0 || IS_INTRA(s->current_picture.f.mb_type[xy - 1])) {
671
671
AV_COPY32(mv_cache[1][0], mv_cache[1][1]);
672
672
AV_COPY32(mv_cache[2][0], mv_cache[2][1]);
674
AV_COPY32(mv_cache[1][0], s->current_picture.motion_val[0][mot_xy-1]);
675
AV_COPY32(mv_cache[2][0], s->current_picture.motion_val[0][mot_xy-1+mot_stride]);
674
AV_COPY32(mv_cache[1][0], s->current_picture.f.motion_val[0][mot_xy - 1]);
675
AV_COPY32(mv_cache[2][0], s->current_picture.f.motion_val[0][mot_xy - 1 + mot_stride]);
678
if(mb_x+1>=s->mb_width || IS_INTRA(s->current_picture.mb_type[xy+1])){
678
if (mb_x + 1 >= s->mb_width || IS_INTRA(s->current_picture.f.mb_type[xy + 1])) {
679
679
AV_COPY32(mv_cache[1][3], mv_cache[1][2]);
680
680
AV_COPY32(mv_cache[2][3], mv_cache[2][2]);
682
AV_COPY32(mv_cache[1][3], s->current_picture.motion_val[0][mot_xy+2]);
683
AV_COPY32(mv_cache[2][3], s->current_picture.motion_val[0][mot_xy+2+mot_stride]);
682
AV_COPY32(mv_cache[1][3], s->current_picture.f.motion_val[0][mot_xy + 2]);
683
AV_COPY32(mv_cache[2][3], s->current_picture.f.motion_val[0][mot_xy + 2 + mot_stride]);
819
819
if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){
820
ref_picture= s->current_picture_ptr->data;
820
ref_picture = s->current_picture_ptr->f.data;
823
823
mpeg_motion(s, dest_y, dest_cb, dest_cr,
834
834
|| s->pict_type == AV_PICTURE_TYPE_B || s->first_field){
835
835
ref2picture= ref_picture;
837
ref2picture= s->current_picture_ptr->data;
837
ref2picture = s->current_picture_ptr->f.data;
840
840
mpeg_motion(s, dest_y, dest_cb, dest_cr,