Revision aa066582

View differences:

libavcodec/dv.c
49 49
    void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size);
50 50
    void (*fdct[2])(DCTELEM *block);
51 51
    void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block);
52

  
53
    /* MultiThreading */
54
    uint8_t** dv_anchor;
55 52
} DVVideoContext;
56 53

  
54
/* MultiThreading - applies to entire DV codec, not just the avcontext */
55
uint8_t** dv_anchor;
56

  
57 57
#define TEX_VLC_BITS 9
58 58

  
59 59
#ifdef DV_CODEC_TINY_TARGET
......
118 118
            return -ENOMEM;
119 119

  
120 120
        /* dv_anchor lets each thread know its Id */
121
        s->dv_anchor = av_malloc(12*27*sizeof(void*));
122
        if (!s->dv_anchor) {
121
        dv_anchor = av_malloc(12*27*sizeof(void*));
122
        if (!dv_anchor) {
123 123
            return -ENOMEM;
124 124
        }
125 125
        for (i=0; i<12*27; i++)
126
            s->dv_anchor[i] = (void*)(size_t)i;
126
            dv_anchor[i] = (void*)(size_t)i;
127 127

  
128 128
        /* it's faster to include sign bit in a generic VLC parsing scheme */
129 129
        for (i=0, j=0; i<NB_DV_VLC; i++, j++) {
......
150 150
                 new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0);
151 151

  
152 152
        dv_rl_vlc = av_mallocz_static(dv_vlc.table_size * sizeof(RL_VLC_ELEM));
153
        if (!dv_rl_vlc) {
154
            av_free(s->dv_anchor);
153
        if (!dv_rl_vlc)
155 154
            return -ENOMEM;
156
        }
155

  
157 156
        for(i = 0; i < dv_vlc.table_size; i++){
158 157
            int code= dv_vlc.table[i][0];
159 158
            int len = dv_vlc.table[i][1];
......
939 938
    s->picture.top_field_first = 0;
940 939

  
941 940
    s->buf = buf;
942
    avctx->execute(avctx, dv_decode_mt, (void**)&s->dv_anchor[0], NULL,
941
    avctx->execute(avctx, dv_decode_mt, (void**)&dv_anchor[0], NULL,
943 942
                   s->sys->difseg_size * 27);
944 943

  
945 944
    emms_c();
......
968 967
    s->picture.pict_type = FF_I_TYPE;
969 968

  
970 969
    s->buf = buf;
971
    c->execute(c, dv_encode_mt, (void**)&s->dv_anchor[0], NULL,
970
    c->execute(c, dv_encode_mt, (void**)&dv_anchor[0], NULL,
972 971
               s->sys->difseg_size * 27);
973 972

  
974 973
    emms_c();
......
977 976

  
978 977
static int dvvideo_close(AVCodecContext *c)
979 978
{
980
    DVVideoContext *s = c->priv_data;
981

  
982
    av_free(s->dv_anchor);
983 979

  
984 980
    return 0;
985 981
}

Also available in: Unified diff