Revision 828cfff6 libavcodec/h264_direct.c

View differences:

libavcodec/h264_direct.c
216 216

  
217 217
    if(h->direct_spatial_mv_pred){
218 218
        int ref[2];
219
        int mv[2][2];
219
        int mv[2];
220 220
        int list;
221 221

  
222 222
        /* ref = min(neighbors) */
......
237 237

  
238 238
                int match_count= (left_ref==ref[list]) + (top_ref==ref[list]) + (refc==ref[list]);
239 239
                if(match_count > 1){ //most common
240
                    mv[list][0]= mid_pred(A[0], B[0], C[0]);
241
                    mv[list][1]= mid_pred(A[1], B[1], C[1]);
240
                    mv[list]= (mid_pred(A[0], B[0], C[0])&0xFFFF)
241
                             +(mid_pred(A[1], B[1], C[1])<<16);
242 242
                }else {
243 243
                    assert(match_count==1);
244 244
                    if(left_ref==ref[list]){
245
                        mv[list][0]= A[0];
246
                        mv[list][1]= A[1];
245
                        mv[list]= *(uint32_t*)A;
247 246
                    }else if(top_ref==ref[list]){
248
                        mv[list][0]= B[0];
249
                        mv[list][1]= B[1];
247
                        mv[list]= *(uint32_t*)B;
250 248
                    }else{
251
                        mv[list][0]= C[0];
252
                        mv[list][1]= C[1];
249
                        mv[list]= *(uint32_t*)C;
253 250
                    }
254 251
                }
255 252
            }else{
256 253
                int mask= ~(MB_TYPE_L0 << (2*list));
257
                mv[list][0] = mv[list][1] = 0;
254
                mv[list] = 0;
258 255
                ref[list] = -1;
259 256
                if(!is_b8x8)
260 257
                    *mb_type &= mask;
......
288 285
                       || (l1ref0[xy8]  < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){
289 286
                    a=b=0;
290 287
                    if(ref[0] > 0)
291
                        a= pack16to32(mv[0][0],mv[0][1]);
288
                        a= mv[0];
292 289
                    if(ref[1] > 0)
293
                        b= pack16to32(mv[1][0],mv[1][1]);
290
                        b= mv[1];
294 291
                    n++;
295 292
                }else{
296
                    a= pack16to32(mv[0][0],mv[0][1]);
297
                    b= pack16to32(mv[1][0],mv[1][1]);
293
                    a= mv[0];
294
                    b= mv[1];
298 295
                }
299 296
                fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4);
300 297
                fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4);
......
312 309
                       && h->x264_build>33U))){
313 310
                a=b=0;
314 311
                if(ref[0] > 0)
315
                    a= pack16to32(mv[0][0],mv[0][1]);
312
                    a= mv[0];
316 313
                if(ref[1] > 0)
317
                    b= pack16to32(mv[1][0],mv[1][1]);
314
                    b= mv[1];
318 315
            }else{
319
                a= pack16to32(mv[0][0],mv[0][1]);
320
                b= pack16to32(mv[1][0],mv[1][1]);
316
                a= mv[0];
317
                b= mv[1];
321 318
            }
322 319
            fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4);
323 320
            fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4);
......
331 328
                    continue;
332 329
                h->sub_mb_type[i8] = sub_mb_type;
333 330

  
334
                fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4);
335
                fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4);
331
                fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, mv[0], 4);
332
                fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, mv[1], 4);
336 333
                fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
337 334
                fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
338 335

  

Also available in: Unified diff