Revision 89912b5f

View differences:

libavcodec/flacenc.c
1101 1101
}
1102 1102

  
1103 1103

  
1104
static void output_subframe_constant(FlacEncodeContext *s, FlacSubframe *sub)
1105
{
1106
    int32_t res;
1107

  
1108
    res = sub->residual[0];
1109
    put_sbits(&s->pb, sub->obits, res);
1110
}
1111

  
1112

  
1113 1104
static void output_subframe_verbatim(FlacEncodeContext *s, FlacSubframe *sub)
1114 1105
{
1115
    int i;
1116
    FlacFrame *frame;
1117
    int32_t res;
1106
    put_sbits(&s->pb, sub->obits, sub->residual[0]);
1118 1107

  
1119
    frame = &s->frame;
1120

  
1121
    for (i = 0; i < frame->blocksize; i++) {
1122
        res = sub->residual[i];
1123
        put_sbits(&s->pb, sub->obits, res);
1108
    if (sub->type == FLAC_SUBFRAME_VERBATIM) {
1109
        int i;
1110
        for (i = 0; i < s->frame.blocksize; i++)
1111
            put_sbits(&s->pb, sub->obits, sub->residual[i]);
1124 1112
    }
1125 1113
}
1126 1114

  
......
1212 1200
        put_bits(&s->pb, 1, 0); /* no wasted bits */
1213 1201

  
1214 1202
        /* subframe */
1215
        if(sub->type == FLAC_SUBFRAME_CONSTANT)
1216
            output_subframe_constant(s, sub);
1217
        else if(sub->type == FLAC_SUBFRAME_VERBATIM)
1218
            output_subframe_verbatim(s, sub);
1219
        else if(sub->type == FLAC_SUBFRAME_FIXED)
1220
            output_subframe_fixed(s, sub);
1221
        else if(sub->type == FLAC_SUBFRAME_LPC)
1222
            output_subframe_lpc(s, sub);
1203
        switch (sub->type) {
1204
        case FLAC_SUBFRAME_CONSTANT:
1205
        case FLAC_SUBFRAME_VERBATIM: output_subframe_verbatim(s, sub); break;
1206
        case FLAC_SUBFRAME_FIXED:    output_subframe_fixed(   s, sub); break;
1207
        case FLAC_SUBFRAME_LPC:      output_subframe_lpc(     s, sub); break;
1208
        }
1223 1209
    }
1224 1210
}
1225 1211

  

Also available in: Unified diff