Mercurial > libavcodec.hg
comparison ffv1.c @ 1605:2fb583cb0013 libavcodec
fix context=1
remove always_inline, gcc fails to inline other more important inline functions otherwise ...
author | michael |
---|---|
date | Thu, 06 Nov 2003 22:05:22 +0000 |
parents | 932d306bf1dc |
children | b7340afa261a |
comparison
equal
deleted
inserted
replaced
1604:21190cfac0e1 | 1605:2fb583cb0013 |
---|---|
362 update_vlc_state(state, v); | 362 update_vlc_state(state, v); |
363 //printf("final: %d\n", ret); | 363 //printf("final: %d\n", ret); |
364 return ret; | 364 return ret; |
365 } | 365 } |
366 | 366 |
367 static always_inline void encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ | 367 static inline void encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ |
368 PlaneContext * const p= &s->plane[plane_index]; | 368 PlaneContext * const p= &s->plane[plane_index]; |
369 CABACContext * const c= &s->c; | 369 CABACContext * const c= &s->c; |
370 int x; | 370 int x; |
371 int run_index= s->run_index; | 371 int run_index= s->run_index; |
372 int run_count=0; | 372 int run_count=0; |
373 int run_mode=0; | 373 int run_mode=0; |
374 | 374 |
375 for(x=0; x<w; x++){ | 375 for(x=0; x<w; x++){ |
376 int diff, context; | 376 int diff, context; |
377 | 377 |
378 context= get_context(s, sample[1]+x, sample[0]+x, sample[1]+x); | 378 context= get_context(s, sample[1]+x, sample[0]+x, sample[2]+x); |
379 diff= sample[1][x] - predict(sample[1]+x, sample[0]+x); | 379 diff= sample[1][x] - predict(sample[1]+x, sample[0]+x); |
380 | 380 |
381 if(context < 0){ | 381 if(context < 0){ |
382 context = -context; | 382 context = -context; |
383 diff= -diff; | 383 diff= -diff; |
428 s->run_index= run_index; | 428 s->run_index= run_index; |
429 } | 429 } |
430 | 430 |
431 static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ | 431 static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ |
432 int x,y; | 432 int x,y; |
433 int_fast16_t sample_buffer[2][w+6]; | 433 int_fast16_t sample_buffer[3][w+6]; |
434 int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; | 434 int_fast16_t *sample[3]= {sample_buffer[0]+3, sample_buffer[1]+3, sample_buffer[2]+3}; |
435 s->run_index=0; | 435 s->run_index=0; |
436 | 436 |
437 memset(sample_buffer, 0, sizeof(sample_buffer)); | 437 memset(sample_buffer, 0, sizeof(sample_buffer)); |
438 | 438 |
439 for(y=0; y<h; y++){ | 439 for(y=0; y<h; y++){ |
440 int_fast16_t *temp= sample[0]; //FIXME try a normal buffer | 440 int_fast16_t *temp= sample[0]; //FIXME try a normal buffer |
441 | 441 |
442 sample[0]= sample[1]; | 442 sample[0]= sample[1]; |
443 sample[1]= temp; | 443 sample[1]= sample[2]; |
444 sample[2]= temp; | |
444 | 445 |
445 sample[1][-1]= sample[0][0 ]; | 446 sample[1][-1]= sample[0][0 ]; |
446 sample[0][ w]= sample[0][w-1]; | 447 sample[0][ w]= sample[0][w-1]; |
447 //{START_TIMER | 448 //{START_TIMER |
448 for(x=0; x<w; x++){ | 449 for(x=0; x<w; x++){ |
709 common_end(s); | 710 common_end(s); |
710 | 711 |
711 return 0; | 712 return 0; |
712 } | 713 } |
713 | 714 |
714 static always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ | 715 static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ |
715 PlaneContext * const p= &s->plane[plane_index]; | 716 PlaneContext * const p= &s->plane[plane_index]; |
716 CABACContext * const c= &s->c; | 717 CABACContext * const c= &s->c; |
717 int x; | 718 int x; |
718 int run_count=0; | 719 int run_count=0; |
719 int run_mode=0; | 720 int run_mode=0; |