Revision 13705b69 libavcodec/snow.c

View differences:

libavcodec/snow.c
589 589
static uint8_t qexp[QROOT];
590 590

  
591 591
static inline int mirror(int v, int m){
592
    if     (v<0) return -v;
593
    else if(v>m) return 2*m-v;
594
    else         return v;
592
    while((unsigned)v > (unsigned)m){
593
        v=-v;
594
        if(v<0) v+= 2*m;
595
    }
596
    return v;
595 597
}
596 598

  
597 599
static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){
......
1095 1097
        DWTELEM *b3= buffer + mirror(y+2, height-1)*stride;
1096 1098

  
1097 1099
{START_TIMER
1098
        if(b1 <= b3)     horizontal_decompose53i(b2, width);
1099
        if(y+2 < height) horizontal_decompose53i(b3, width);
1100
        if(y+1<(unsigned)height) horizontal_decompose53i(b2, width);
1101
        if(y+2<(unsigned)height) horizontal_decompose53i(b3, width);
1100 1102
STOP_TIMER("horizontal_decompose53i")}
1101 1103

  
1102 1104
{START_TIMER
1103
        if(b1 <= b3) vertical_decompose53iH0(b1, b2, b3, width);
1104
        if(b0 <= b2) vertical_decompose53iL0(b0, b1, b2, width);
1105
        if(y+1<(unsigned)height) vertical_decompose53iH0(b1, b2, b3, width);
1106
        if(y+0<(unsigned)height) vertical_decompose53iL0(b0, b1, b2, width);
1105 1107
STOP_TIMER("vertical_decompose53i*")}
1106 1108

  
1107 1109
        b0=b2;
......
1245 1247
        DWTELEM *b5= buffer + mirror(y+4, height-1)*stride;
1246 1248

  
1247 1249
{START_TIMER
1248
        if(b3 <= b5)     horizontal_decompose97i(b4, width);
1249
        if(y+4 < height) horizontal_decompose97i(b5, width);
1250
        if(y+3<(unsigned)height) horizontal_decompose97i(b4, width);
1251
        if(y+4<(unsigned)height) horizontal_decompose97i(b5, width);
1250 1252
if(width>400){
1251 1253
STOP_TIMER("horizontal_decompose97i")
1252 1254
}}
1253 1255

  
1254 1256
{START_TIMER
1255
        if(b3 <= b5) vertical_decompose97iH0(b3, b4, b5, width);
1256
        if(b2 <= b4) vertical_decompose97iL0(b2, b3, b4, width);
1257
        if(b1 <= b3) vertical_decompose97iH1(b1, b2, b3, width);
1258
        if(b0 <= b2) vertical_decompose97iL1(b0, b1, b2, width);
1257
        if(y+3<(unsigned)height) vertical_decompose97iH0(b3, b4, b5, width);
1258
        if(y+2<(unsigned)height) vertical_decompose97iL0(b2, b3, b4, width);
1259
        if(y+1<(unsigned)height) vertical_decompose97iH1(b1, b2, b3, width);
1260
        if(y+0<(unsigned)height) vertical_decompose97iL1(b0, b1, b2, width);
1259 1261

  
1260 1262
if(width>400){
1261 1263
STOP_TIMER("vertical_decompose97i")
......
1368 1370
    DWTELEM *b3= slice_buffer_get_line(sb, mirror3 * stride_line);
1369 1371

  
1370 1372
{START_TIMER
1371
        if(mirror1 <= mirror3) vertical_compose53iL0(b1, b2, b3, width);
1372
        if(mirror0 <= mirror2) vertical_compose53iH0(b0, b1, b2, width);
1373
        if(y+1<(unsigned)height) vertical_compose53iL0(b1, b2, b3, width);
1374
        if(y+0<(unsigned)height) vertical_compose53iH0(b0, b1, b2, width);
1373 1375
STOP_TIMER("vertical_compose53i*")}
1374 1376

  
1375 1377
{START_TIMER
1376
        if(y-1 >= 0) horizontal_compose53i(b0, width);
1377
        if(mirror0 <= mirror2) horizontal_compose53i(b1, width);
1378
        if(y-1<(unsigned)height) horizontal_compose53i(b0, width);
1379
        if(y+0<(unsigned)height) horizontal_compose53i(b1, width);
1378 1380
STOP_TIMER("horizontal_compose53i")}
1379 1381

  
1380 1382
    cs->b0 = b2;
......
1390 1392
    DWTELEM *b3= buffer + mirror(y+2, height-1)*stride;
1391 1393

  
1392 1394
{START_TIMER
1393
        if(b1 <= b3) vertical_compose53iL0(b1, b2, b3, width);
1394
        if(b0 <= b2) vertical_compose53iH0(b0, b1, b2, width);
1395
        if(y+1<(unsigned)height) vertical_compose53iL0(b1, b2, b3, width);
1396
        if(y+0<(unsigned)height) vertical_compose53iH0(b0, b1, b2, width);
1395 1397
STOP_TIMER("vertical_compose53i*")}
1396 1398

  
1397 1399
{START_TIMER
1398
        if(y-1 >= 0) horizontal_compose53i(b0, width);
1399
        if(b0 <= b2) horizontal_compose53i(b1, width);
1400
        if(y-1<(unsigned)height) horizontal_compose53i(b0, width);
1401
        if(y+0<(unsigned)height) horizontal_compose53i(b1, width);
1400 1402
STOP_TIMER("horizontal_compose53i")}
1401 1403

  
1402 1404
    cs->b0 = b2;
......
1526 1528
    if(y>0 && y+4<height){
1527 1529
        vertical_compose97i(b0, b1, b2, b3, b4, b5, width);
1528 1530
    }else{
1529
        if(mirror3 <= mirror5) vertical_compose97iL1(b3, b4, b5, width);
1530
        if(mirror2 <= mirror4) vertical_compose97iH1(b2, b3, b4, width);
1531
        if(mirror1 <= mirror3) vertical_compose97iL0(b1, b2, b3, width);
1532
        if(mirror0 <= mirror2) vertical_compose97iH0(b0, b1, b2, width);
1531
        if(y+3<(unsigned)height) vertical_compose97iL1(b3, b4, b5, width);
1532
        if(y+2<(unsigned)height) vertical_compose97iH1(b2, b3, b4, width);
1533
        if(y+1<(unsigned)height) vertical_compose97iL0(b1, b2, b3, width);
1534
        if(y+0<(unsigned)height) vertical_compose97iH0(b0, b1, b2, width);
1533 1535
    }
1534 1536
if(width>400){
1535 1537
STOP_TIMER("vertical_compose97i")}}
1536 1538

  
1537 1539
{START_TIMER
1538
        if(y-1>=  0) horizontal_compose97i(b0, width);
1539
        if(mirror0 <= mirror2) horizontal_compose97i(b1, width);
1540
        if(y-1<(unsigned)height) horizontal_compose97i(b0, width);
1541
        if(y+0<(unsigned)height) horizontal_compose97i(b1, width);
1540 1542
if(width>400 && mirror0 <= mirror2){
1541 1543
STOP_TIMER("horizontal_compose97i")}}
1542 1544

  
......
1565 1567
        }
1566 1568

  
1567 1569
{START_TIMER
1568
        if(b3 <= b5) vertical_compose97iL1(b3, b4, b5, width);
1569
        if(b2 <= b4) vertical_compose97iH1(b2, b3, b4, width);
1570
        if(b1 <= b3) vertical_compose97iL0(b1, b2, b3, width);
1571
        if(b0 <= b2) vertical_compose97iH0(b0, b1, b2, width);
1570
        if(y+3<(unsigned)height) vertical_compose97iL1(b3, b4, b5, width);
1571
        if(y+2<(unsigned)height) vertical_compose97iH1(b2, b3, b4, width);
1572
        if(y+1<(unsigned)height) vertical_compose97iL0(b1, b2, b3, width);
1573
        if(y+0<(unsigned)height) vertical_compose97iH0(b0, b1, b2, width);
1572 1574
if(width>400){
1573 1575
STOP_TIMER("vertical_compose97i")}}
1574 1576

  
1575 1577
{START_TIMER
1576
        if(y-1>=  0) horizontal_compose97i(b0, width);
1577
        if(b0 <= b2) horizontal_compose97i(b1, width);
1578
        if(y-1<(unsigned)height) horizontal_compose97i(b0, width);
1579
        if(y+0<(unsigned)height) horizontal_compose97i(b1, width);
1578 1580
if(width>400 && b0 <= b2){
1579 1581
STOP_TIMER("horizontal_compose97i")}}
1580 1582

  
......
3199 3201
                        dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+square[i][0], block->my+square[i][1]}, 0, &best_rd);
3200 3202
                }while(dia_change);
3201 3203
                //FIXME or try the standard 2 pass qpel or similar
3202

  
3204
#if 1
3203 3205
                for(i=0; i<3; i++){
3204 3206
                    color[i]= get_dc(s, mb_x, mb_y, i);
3205 3207
                }
3206 3208
                check_block(s, mb_x, mb_y, color, 1, &best_rd);
3207 3209
                //FIXME RD style color selection
3208

  
3210
#endif
3209 3211
                if(!same_block(block, &backup)){
3210 3212
                    if(tb != &null_block) tb ->type &= ~BLOCK_OPT;
3211 3213
                    if(lb != &null_block) lb ->type &= ~BLOCK_OPT;

Also available in: Unified diff