Revision 79db7ac6

View differences:

libavcodec/h264.c
1951 1951
        av_freep(&hx->top_borders[1]);
1952 1952
        av_freep(&hx->top_borders[0]);
1953 1953
        av_freep(&hx->s.obmc_scratchpad);
1954
        av_freep(&hx->s.allocated_edge_emu_buffer);
1955 1954
    }
1956 1955
}
1957 1956

  
......
2096 2095
    CHECKED_ALLOCZ(h->top_borders[0], h->s.mb_width * (16+8+8) * sizeof(uint8_t))
2097 2096
    CHECKED_ALLOCZ(h->top_borders[1], h->s.mb_width * (16+8+8) * sizeof(uint8_t))
2098 2097

  
2099
    // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264)
2100
    CHECKED_ALLOCZ(s->allocated_edge_emu_buffer,
2101
                   (s->width+64)*2*21*2); //(width + edge + align)*interlaced*MBsize*tolerance
2102
    s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21;
2103 2098
    return 0;
2104 2099
fail:
2105 2100
    return -1; // free_tables will clean up for us
......
3907 3902
        for(i = 1; i < s->avctx->thread_count; i++) {
3908 3903
            H264Context *c;
3909 3904
            c = h->thread_context[i] = av_malloc(sizeof(H264Context));
3910
            memcpy(c, h, sizeof(MpegEncContext));
3905
            memcpy(c, h->s.thread_context[i], sizeof(MpegEncContext));
3911 3906
            memset(&c->s + 1, 0, sizeof(H264Context) - sizeof(MpegEncContext));
3912 3907
            c->sps = h->sps;
3913 3908
            c->pps = h->pps;
libavcodec/mpegvideo.c
587 587
    s->context_initialized = 1;
588 588

  
589 589
    s->thread_context[0]= s;
590
    /* h264 does thread context setup itself, but it needs context[0]
591
     * to be fully initialized for the error resilience code */
592
    threads = s->codec_id == CODEC_ID_H264 ? 1 : s->avctx->thread_count;
590
    threads = s->avctx->thread_count;
593 591

  
594 592
    for(i=1; i<threads; i++){
595 593
        s->thread_context[i]= av_malloc(sizeof(MpegEncContext));

Also available in: Unified diff