return 0;
}
-static void loop_filter(H264Context *h){
+static void loop_filter(H264Context *h, int start_x, int end_x){
MpegEncContext * const s = &h->s;
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize, mb_x, mb_y;
const int pixel_shift = h->pixel_shift;
if(h->deblocking_filter) {
- for(mb_x= 0; mb_x<s->mb_width; mb_x++){
+ for(mb_x= start_x; mb_x<end_x; mb_x++){
for(mb_y=end_mb_y - FRAME_MBAFF; mb_y<= end_mb_y; mb_y++){
int mb_xy, mb_type;
mb_xy = h->mb_xy = mb_x + mb_y*s->mb_stride;
H264Context *h = *(void**)arg;
MpegEncContext * const s = &h->s;
const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
+ int lf_x_start = s->mb_x;
s->mb_skip_run= -1;
if((s->workaround_bugs & FF_BUG_TRUNCATED) && h->cabac.bytestream > h->cabac.bytestream_end + 2){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
+ if (s->mb_x >= lf_x_start) loop_filter(h, lf_x_start, s->mb_x + 1);
return 0;
}
if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) {
}
if( ++s->mb_x >= s->mb_width ) {
- s->mb_x = 0;
- loop_filter(h);
+ loop_filter(h, lf_x_start, s->mb_x);
+ s->mb_x = lf_x_start = 0;
ff_draw_horiz_band(s, 16*s->mb_y, 16);
++s->mb_y;
if(FIELD_OR_MBAFF_PICTURE) {
if( eos || s->mb_y >= s->mb_height ) {
tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
+ if (s->mb_x > lf_x_start) loop_filter(h, lf_x_start, s->mb_x);
return 0;
}
}
if(ret<0){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
-
return -1;
}
if(++s->mb_x >= s->mb_width){
- s->mb_x=0;
- loop_filter(h);
+ loop_filter(h, lf_x_start, s->mb_x);
+ s->mb_x = lf_x_start = 0;
ff_draw_horiz_band(s, 16*s->mb_y, 16);
++s->mb_y;
if(FIELD_OR_MBAFF_PICTURE) {
tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
if(get_bits_count(&s->gb) == s->gb.size_in_bits ){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
+ if (s->mb_x > lf_x_start) loop_filter(h, lf_x_start, s->mb_x);
return 0;
}else{