Mercurial > libavcodec.hg
comparison mpeg12.c @ 1668:30746f429df6 libavcodec
move motion_val & mb_type to AVFrame patch by (Wolfgang Hesseler <qv at multimediaware dot com>)
cleanups & fixes by me
author | michael |
---|---|
date | Tue, 09 Dec 2003 01:49:56 +0000 |
parents | c92147a61d97 |
children | 1c9e8e499c56 |
comparison
equal
deleted
inserted
replaced
1667:720c073661a1 | 1668:30746f429df6 |
---|---|
2129 s->chroma_qscale= s->qscale; | 2129 s->chroma_qscale= s->qscale; |
2130 | 2130 |
2131 dprintf("ret=%d\n", ret); | 2131 dprintf("ret=%d\n", ret); |
2132 if (ret < 0) | 2132 if (ret < 0) |
2133 return -1; | 2133 return -1; |
2134 | 2134 |
2135 if(s->motion_val && s->pict_type != B_TYPE){ //note motion_val is normally NULL unless we want to extract the MVs | 2135 if(s->current_picture.motion_val[0]){ //note motion_val is normally NULL unless we want to extract the MVs |
2136 const int wrap = s->block_wrap[0]; | 2136 const int wrap = s->block_wrap[0]; |
2137 const int xy = s->mb_x*2 + 1 + (s->mb_y*2 +1)*wrap; | 2137 const int xy = s->mb_x*2 + 1 + (s->mb_y*2 +1)*wrap; |
2138 int motion_x, motion_y; | 2138 int motion_for_x, motion_for_y, motion_back_x, motion_back_y; |
2139 | |
2140 if (s->mb_intra) { | 2139 if (s->mb_intra) { |
2141 motion_x = motion_y = 0; | 2140 motion_for_x = motion_for_y = motion_back_x = motion_back_y = 0; |
2142 }else if (s->mv_type == MV_TYPE_16X16) { | 2141 }else if (s->mv_type == MV_TYPE_16X16){ |
2143 motion_x = s->mv[0][0][0]; | 2142 motion_for_x = s->mv[0][0][0]; |
2144 motion_y = s->mv[0][0][1]; | 2143 motion_for_y = s->mv[0][0][1]; |
2145 } else /*if (s->mv_type == MV_TYPE_FIELD)*/ { | 2144 motion_back_x = s->mv[1][0][0]; |
2146 motion_x = s->mv[0][0][0] + s->mv[0][1][0]; | 2145 motion_back_y = s->mv[1][0][1]; |
2147 motion_y = s->mv[0][0][1] + s->mv[0][1][1]; | 2146 } else /*if ((s->mv_type == MV_TYPE_FIELD) || (s->mv_type == MV_TYPE_16X8))*/ { |
2148 motion_x = (motion_x>>1) | (motion_x&1); | 2147 motion_for_x = s->mv[0][0][0] + s->mv[0][1][0]; |
2149 } | 2148 motion_for_y = s->mv[0][0][1] + s->mv[0][1][1]; |
2150 s->motion_val[xy][0] = motion_x; | 2149 motion_for_x = (motion_for_x>>1) | (motion_for_x&1); |
2151 s->motion_val[xy][1] = motion_y; | 2150 motion_back_x = s->mv[1][0][0] + s->mv[1][1][0]; |
2152 s->motion_val[xy + 1][0] = motion_x; | 2151 motion_back_y = s->mv[1][0][1] + s->mv[1][1][1]; |
2153 s->motion_val[xy + 1][1] = motion_y; | 2152 motion_back_x = (motion_back_x>>1) | (motion_back_x&1); |
2154 s->motion_val[xy + wrap][0] = motion_x; | 2153 } |
2155 s->motion_val[xy + wrap][1] = motion_y; | 2154 |
2156 s->motion_val[xy + 1 + wrap][0] = motion_x; | 2155 s->current_picture.motion_val[0][xy][0] = motion_for_x; |
2157 s->motion_val[xy + 1 + wrap][1] = motion_y; | 2156 s->current_picture.motion_val[0][xy][1] = motion_for_y; |
2158 } | 2157 s->current_picture.motion_val[0][xy + 1][0] = motion_for_x; |
2159 | 2158 s->current_picture.motion_val[0][xy + 1][1] = motion_for_y; |
2159 s->current_picture.motion_val[0][xy + wrap][0] = motion_for_x; | |
2160 s->current_picture.motion_val[0][xy + wrap][1] = motion_for_y; | |
2161 s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_for_x; | |
2162 s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_for_y; | |
2163 | |
2164 if(s->pict_type != B_TYPE){ | |
2165 motion_back_x = motion_back_y = 0; | |
2166 } | |
2167 | |
2168 s->current_picture.motion_val[1][xy][0] = motion_back_x; | |
2169 s->current_picture.motion_val[1][xy][1] = motion_back_y; | |
2170 s->current_picture.motion_val[1][xy + 1][0] = motion_back_x; | |
2171 s->current_picture.motion_val[1][xy + 1][1] = motion_back_y; | |
2172 s->current_picture.motion_val[1][xy + wrap][0] = motion_back_x; | |
2173 s->current_picture.motion_val[1][xy + wrap][1] = motion_back_y; | |
2174 s->current_picture.motion_val[1][xy + 1 + wrap][0] = motion_back_x; | |
2175 s->current_picture.motion_val[1][xy + 1 + wrap][1] = motion_back_y; | |
2176 } | |
2177 | |
2160 s->dest[0] += 16; | 2178 s->dest[0] += 16; |
2161 s->dest[1] += 8; | 2179 s->dest[1] += 8; |
2162 s->dest[2] += 8; | 2180 s->dest[2] += 8; |
2163 | 2181 |
2164 MPV_decode_mb(s, s->block); | 2182 MPV_decode_mb(s, s->block); |