comparison h264.c @ 2200:733c60a6e30c libavcodec

h264 deblocking crash patch by (Loren Merritt <lorenm at u dot washington dot edu>)
author michael
date Thu, 02 Sep 2004 10:49:54 +0000
parents 24ed7893bf82
children bf414a07af2e
comparison
equal deleted inserted replaced
2199:e0b08bdf565d 2200:733c60a6e30c
2319 2319
2320 static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg){ 2320 static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg){
2321 MpegEncContext * const s = &h->s; 2321 MpegEncContext * const s = &h->s;
2322 int temp8, i; 2322 int temp8, i;
2323 uint64_t temp64; 2323 uint64_t temp64;
2324 int deblock_left = (s->mb_x > 0);
2325 int deblock_top = (s->mb_y > 0);
2324 2326
2325 src_y -= linesize + 1; 2327 src_y -= linesize + 1;
2326 src_cb -= uvlinesize + 1; 2328 src_cb -= uvlinesize + 1;
2327 src_cr -= uvlinesize + 1; 2329 src_cr -= uvlinesize + 1;
2328 2330
2329 #define XCHG(a,b,t,xchg)\ 2331 #define XCHG(a,b,t,xchg)\
2330 t= a;\ 2332 t= a;\
2331 if(xchg)\ 2333 if(xchg)\
2332 a= b;\ 2334 a= b;\
2333 b= t; 2335 b= t;
2334 2336
2335 for(i=0; i<17; i++){ 2337 if(deblock_left){
2336 XCHG(h->left_border[i ], src_y [i* linesize], temp8, xchg); 2338 for(i = !deblock_top; i<17; i++){
2337 } 2339 XCHG(h->left_border[i ], src_y [i* linesize], temp8, xchg);
2338 2340 }
2339 XCHG(*(uint64_t*)(h->top_border[s->mb_x]+0), *(uint64_t*)(src_y +1), temp64, xchg); 2341 }
2340 XCHG(*(uint64_t*)(h->top_border[s->mb_x]+8), *(uint64_t*)(src_y +9), temp64, 1); 2342
2343 if(deblock_top){
2344 XCHG(*(uint64_t*)(h->top_border[s->mb_x]+0), *(uint64_t*)(src_y +1), temp64, xchg);
2345 XCHG(*(uint64_t*)(h->top_border[s->mb_x]+8), *(uint64_t*)(src_y +9), temp64, 1);
2346 }
2341 2347
2342 if(!(s->flags&CODEC_FLAG_GRAY)){ 2348 if(!(s->flags&CODEC_FLAG_GRAY)){
2343 for(i=0; i<9; i++){ 2349 if(deblock_left){
2344 XCHG(h->left_border[i+17 ], src_cb[i*uvlinesize], temp8, xchg); 2350 for(i = !deblock_top; i<9; i++){
2345 XCHG(h->left_border[i+17+9], src_cr[i*uvlinesize], temp8, xchg); 2351 XCHG(h->left_border[i+17 ], src_cb[i*uvlinesize], temp8, xchg);
2346 } 2352 XCHG(h->left_border[i+17+9], src_cr[i*uvlinesize], temp8, xchg);
2347 XCHG(*(uint64_t*)(h->top_border[s->mb_x]+16), *(uint64_t*)(src_cb+1), temp64, 1); 2353 }
2348 XCHG(*(uint64_t*)(h->top_border[s->mb_x]+24), *(uint64_t*)(src_cr+1), temp64, 1); 2354 }
2355 if(deblock_top){
2356 XCHG(*(uint64_t*)(h->top_border[s->mb_x]+16), *(uint64_t*)(src_cb+1), temp64, 1);
2357 XCHG(*(uint64_t*)(h->top_border[s->mb_x]+24), *(uint64_t*)(src_cr+1), temp64, 1);
2358 }
2349 } 2359 }
2350 } 2360 }
2351 2361
2352 static void hl_decode_mb(H264Context *h){ 2362 static void hl_decode_mb(H264Context *h){
2353 MpegEncContext * const s = &h->s; 2363 MpegEncContext * const s = &h->s;