Revision d2d600b7 libavcodec/mpegvideo_xvmc.c

View differences:

libavcodec/mpegvideo_xvmc.c
38 38
void ff_xvmc_init_block(MpegEncContext *s)
39 39
{
40 40
    struct xvmc_pixfmt_render *render = (struct xvmc_pixfmt_render*)s->current_picture.data[2];
41
    if (!render || render->magic_id != AV_XVMC_RENDER_MAGIC) {
42
        assert(0);
43
        return; // make sure that this is a render packet
44
    }
41
    assert(render && render->magic_id == AV_XVMC_RENDER_MAGIC);
42

  
45 43
    s->block = (DCTELEM *)(render->data_blocks + render->next_free_data_block_num * 64);
46 44
}
47 45

  
......
67 65
int ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx)
68 66
{
69 67
    struct xvmc_pixfmt_render *last, *next, *render = (struct xvmc_pixfmt_render*)s->current_picture.data[2];
68
    const int mb_block_count = 4 + (1 << s->chroma_format);
70 69

  
71 70
    assert(avctx);
72
    if (!render || render->magic_id != AV_XVMC_RENDER_MAGIC)
71
    if (!render || render->magic_id != AV_XVMC_RENDER_MAGIC ||
72
        !render->data_blocks || !render->mv_blocks){
73
        av_log(avctx, AV_LOG_ERROR,
74
               "Render token doesn't look as expected.\n");
73 75
        return -1; // make sure that this is a render packet
76
    }
74 77

  
75 78
    render->picture_structure = s->picture_structure;
76 79
    render->flags             = s->first_field ? 0 : XVMC_SECOND_FIELD;
77 80

  
78 81
    if (render->filled_mv_blocks_num) {
79 82
        av_log(avctx, AV_LOG_ERROR,
80
               "Rendering surface contains %i unprocessed blocks\n",
83
               "Rendering surface contains %i unprocessed blocks.\n",
81 84
               render->filled_mv_blocks_num);
82 85
        return -1;
83 86
    }
87
    if (render->total_number_of_mv_blocks   < 1 ||
88
        render->total_number_of_data_blocks < mb_block_count) {
89
        av_log(avctx, AV_LOG_ERROR,
90
               "Rendering surface doesn't provide enough block structures to work with.\n");
91
        return -1;
92
    }
93
    if (render->total_number_of_mv_blocks   < 1 ||
94
        render->total_number_of_data_blocks < mb_block_count) {
95
        av_log(avctx, AV_LOG_ERROR,
96
               "Rendering surface doesn't provide enough block structures to work with.\n");
97
        return -1;
98
    }
84 99

  
85 100
    render->p_future_surface = NULL;
86 101
    render->p_past_surface   = NULL;

Also available in: Unified diff