Revision 01e795ab libavcodec/mpeg12.c

View differences:

libavcodec/mpeg12.c
221 221
    assert(s->mb_skipped==0);
222 222

  
223 223
    if (s->mb_skip_run-- != 0) {
224
        if(s->pict_type == I_TYPE){
225
            av_log(s->avctx, AV_LOG_ERROR, "skipped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
226
            return -1;
227
        }
228

  
229
        /* skip mb */
230
        s->mb_intra = 0;
231
        for(i=0;i<12;i++)
232
            s->block_last_index[i] = -1;
233
        if(s->picture_structure == PICT_FRAME)
234
            s->mv_type = MV_TYPE_16X16;
235
        else
236
            s->mv_type = MV_TYPE_FIELD;
237 224
        if (s->pict_type == P_TYPE) {
238
            /* if P type, zero motion vector is implied */
239
            s->mv_dir = MV_DIR_FORWARD;
240
            s->mv[0][0][0] = s->mv[0][0][1] = 0;
241
            s->last_mv[0][0][0] = s->last_mv[0][0][1] = 0;
242
            s->last_mv[0][1][0] = s->last_mv[0][1][1] = 0;
243
            s->field_select[0][0]= s->picture_structure - 1;
244 225
            s->mb_skipped = 1;
245 226
            s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
246 227
        } else {
......
253 234
            if(IS_INTRA(mb_type))
254 235
                return -1;
255 236

  
256
            /* if B type, reuse previous vectors and directions */
257
            s->mv[0][0][0] = s->last_mv[0][0][0];
258
            s->mv[0][0][1] = s->last_mv[0][0][1];
259
            s->mv[1][0][0] = s->last_mv[1][0][0];
260
            s->mv[1][0][1] = s->last_mv[1][0][1];
261

  
262 237
            s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]=
263 238
                mb_type | MB_TYPE_SKIP;
264 239
//            assert(s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1]&(MB_TYPE_16x16|MB_TYPE_16x8));
......
1828 1803
                    break;
1829 1804
                }
1830 1805
            }
1806
            if(s->mb_skip_run){
1807
                int i;
1808
                if(s->pict_type == I_TYPE){
1809
                    av_log(s->avctx, AV_LOG_ERROR, "skipped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
1810
                    return -1;
1811
                }
1812

  
1813
                /* skip mb */
1814
                s->mb_intra = 0;
1815
                for(i=0;i<12;i++)
1816
                    s->block_last_index[i] = -1;
1817
                if(s->picture_structure == PICT_FRAME)
1818
                    s->mv_type = MV_TYPE_16X16;
1819
                else
1820
                    s->mv_type = MV_TYPE_FIELD;
1821
                if (s->pict_type == P_TYPE) {
1822
                    /* if P type, zero motion vector is implied */
1823
                    s->mv_dir = MV_DIR_FORWARD;
1824
                    s->mv[0][0][0] = s->mv[0][0][1] = 0;
1825
                    s->last_mv[0][0][0] = s->last_mv[0][0][1] = 0;
1826
                    s->last_mv[0][1][0] = s->last_mv[0][1][1] = 0;
1827
                    s->field_select[0][0]= s->picture_structure - 1;
1828
                } else {
1829
                    /* if B type, reuse previous vectors and directions */
1830
                    s->mv[0][0][0] = s->last_mv[0][0][0];
1831
                    s->mv[0][0][1] = s->last_mv[0][0][1];
1832
                    s->mv[1][0][0] = s->last_mv[1][0][0];
1833
                    s->mv[1][0][1] = s->last_mv[1][0][1];
1834
                }
1835
            }
1831 1836
        }
1832 1837
    }
1833 1838
eos: // end of slice

Also available in: Unified diff