Replace all (x == NULL) or (x != NULL) in assert and if conditions by !x and x.
[ffmpeg.git] / libavcodec / mpegvideo_xvmc.c
index 96735e7..dd3ff13 100644 (file)
@@ -40,8 +40,8 @@ void XVMC_init_block(MpegEncContext *s)
 {
     struct xvmc_render_state * render;
     render = (struct xvmc_render_state*)s->current_picture.data[2];
-    assert(render != NULL);
-    if ((render == NULL) || (render->magic != MP_XVMC_RENDER_MAGIC)) {
+    assert(render);
+    if (!render || (render->magic != MP_XVMC_RENDER_MAGIC)) {
         assert(0);
         return;//make sure that this is a render packet
     }
@@ -71,30 +71,29 @@ int XVMC_field_start(MpegEncContext*s, AVCodecContext *avctx)
 {
     struct xvmc_render_state * render, * last, * next;
 
-    assert(avctx != NULL);
+    assert(avctx);
 
     render = (struct xvmc_render_state*)s->current_picture.data[2];
-    assert(render != NULL);
-    if ((render == NULL) || (render->magic != MP_XVMC_RENDER_MAGIC))
+    assert(render);
+    if (!render || (render->magic != MP_XVMC_RENDER_MAGIC))
         return -1;//make sure that this is render packet
 
     render->picture_structure = s->picture_structure;
-    render->flags = (s->first_field) ? 0 : XVMC_SECOND_FIELD;
+    render->flags             = (s->first_field) ? 0 : XVMC_SECOND_FIELD;
 
 //make sure that all data is drawn by XVMC_end_frame
     assert(render->filled_mv_blocks_num == 0);
 
     render->p_future_surface = NULL;
-    render->p_past_surface = NULL;
+    render->p_past_surface   = NULL;
 
     switch(s->pict_type){
         case  FF_I_TYPE:
             return 0;// no prediction from other frames
         case  FF_B_TYPE:
             next = (struct xvmc_render_state*)s->next_picture.data[2];
-            assert(next!=NULL);
-            assert(next->state & MP_XVMC_STATE_PREDICTION);
-            if (next == NULL)
+            assert(next);
+            if (!next)
                 return -1;
             if (next->magic != MP_XVMC_RENDER_MAGIC)
                 return -1;
@@ -102,11 +101,10 @@ int XVMC_field_start(MpegEncContext*s, AVCodecContext *avctx)
             //no return here, going to set forward prediction
         case  FF_P_TYPE:
             last = (struct xvmc_render_state*)s->last_picture.data[2];
-            if (last == NULL)// && !s->first_field)
+            if (!last)// && !s->first_field)
                 last = render;//predict second field from the first
             if (last->magic != MP_XVMC_RENDER_MAGIC)
                 return -1;
-            assert(last->state & MP_XVMC_STATE_PREDICTION);
             render->p_past_surface = last->p_surface;
             return 0;
     }
@@ -118,7 +116,7 @@ void XVMC_field_end(MpegEncContext *s)
 {
     struct xvmc_render_state * render;
     render = (struct xvmc_render_state*)s->current_picture.data[2];
-    assert(render != NULL);
+    assert(render);
 
     if (render->filled_mv_blocks_num > 0)
         ff_draw_horiz_band(s,0,0);
@@ -156,7 +154,7 @@ void XVMC_decode_mb(MpegEncContext *s)
 
 //START OF XVMC specific code
     render = (struct xvmc_render_state*)s->current_picture.data[2];
-    assert(render!=NULL);
+    assert(render);
     assert(render->magic==MP_XVMC_RENDER_MAGIC);
     assert(render->mv_blocks);
 
@@ -164,8 +162,8 @@ void XVMC_decode_mb(MpegEncContext *s)
     mv_block = &render->mv_blocks[render->start_mv_blocks_num +
                                   render->filled_mv_blocks_num ];
 
-    mv_block->x = s->mb_x;
-    mv_block->y = s->mb_y;
+    mv_block->x        = s->mb_x;
+    mv_block->y        = s->mb_y;
     mv_block->dct_type = s->interlaced_dct;//XVMC_DCT_TYPE_FRAME/FIELD;
     if (s->mb_intra){
         mv_block->macroblock_type = XVMC_MB_TYPE_INTRA;//no MC, all done
@@ -294,7 +292,7 @@ void XVMC_decode_mb(MpegEncContext *s)
     }
     render->filled_mv_blocks_num++;
 
-    assert(render->filled_mv_blocks_num <= render->total_number_of_mv_blocks);
+    assert(render->filled_mv_blocks_num     <= render->total_number_of_mv_blocks);
     assert(render->next_free_data_block_num <= render->total_number_of_data_blocks);