[FFmpeg-cvslog] r19647 - in trunk/libavcodec: libdirac_libschro.c libdiracdec.c libdiracenc.c libschroedingerdec.c libschroedingerenc.c

diego subversion
Sat Aug 15 13:02:50 CEST 2009


Author: diego
Date: Sat Aug 15 13:02:50 2009
New Revision: 19647

Log:
Simplify 'if' condition statements.
Drop useless '!= 0' from 'exp != 0', replace 'exp == 0' by '!exp'.

Modified:
   trunk/libavcodec/libdirac_libschro.c
   trunk/libavcodec/libdiracdec.c
   trunk/libavcodec/libdiracenc.c
   trunk/libavcodec/libschroedingerdec.c
   trunk/libavcodec/libschroedingerenc.c

Modified: trunk/libavcodec/libdirac_libschro.c
==============================================================================
--- trunk/libavcodec/libdirac_libschro.c	Sat Aug 15 11:12:58 2009	(r19646)
+++ trunk/libavcodec/libdirac_libschro.c	Sat Aug 15 13:02:50 2009	(r19647)
@@ -86,12 +86,12 @@ int ff_dirac_schro_queue_push_back (Ffmp
     FfmpegDiracSchroQueueElement *p_new =
                              av_mallocz(sizeof(FfmpegDiracSchroQueueElement));
 
-    if (p_new == NULL)
+    if (!p_new)
         return -1;
 
     p_new->data = p_data;
 
-    if (queue->p_head == NULL)
+    if (!queue->p_head)
         queue->p_head = p_new;
     else
         queue->p_tail->next = p_new;
@@ -105,7 +105,7 @@ void *ff_dirac_schro_queue_pop (FfmpegDi
 {
     FfmpegDiracSchroQueueElement *top = queue->p_head;
 
-    if (top != NULL) {
+    if (top) {
         void *data = top->data;
         queue->p_head = queue->p_head->next;
         --queue->size;

Modified: trunk/libavcodec/libdiracdec.c
==============================================================================
--- trunk/libavcodec/libdiracdec.c	Sat Aug 15 11:12:58 2009	(r19646)
+++ trunk/libavcodec/libdiracdec.c	Sat Aug 15 13:02:50 2009	(r19647)
@@ -141,7 +141,7 @@ static int libdirac_decode_frame(AVCodec
                                            avccontext->height);
 
             /* allocate output buffer */
-            if (p_dirac_params->p_out_frame_buf == NULL)
+            if (!p_dirac_params->p_out_frame_buf)
                 p_dirac_params->p_out_frame_buf = av_malloc (pict_size);
             buffer[0] = p_dirac_params->p_out_frame_buf;
             buffer[1] = p_dirac_params->p_out_frame_buf +

Modified: trunk/libavcodec/libdiracenc.c
==============================================================================
--- trunk/libavcodec/libdiracenc.c	Sat Aug 15 11:12:58 2009	(r19646)
+++ trunk/libavcodec/libdiracenc.c	Sat Aug 15 13:02:50 2009	(r19647)
@@ -175,7 +175,7 @@ static av_cold int libdirac_encode_init(
     }
 
     /* Intra-only sequence */
-    if (avccontext->gop_size == 0 ) {
+    if (!avccontext->gop_size) {
         p_dirac_params->enc_ctx.enc_params.num_L1 = 0;
         if (avccontext->coder_type == FF_CODER_TYPE_VLC)
             p_dirac_params->enc_ctx.enc_params.using_ac = 0;
@@ -183,7 +183,7 @@ static av_cold int libdirac_encode_init(
         avccontext->has_b_frames = 1;
 
     if (avccontext->flags & CODEC_FLAG_QSCALE) {
-        if (avccontext->global_quality != 0) {
+        if (avccontext->global_quality) {
             p_dirac_params->enc_ctx.enc_params.qf =
                             avccontext->global_quality / (FF_QP2LAMBDA*10.0);
             /* if it is not default bitrate then send target rate. */
@@ -246,7 +246,7 @@ static int libdirac_encode_frame(AVCodec
     int go = 1;
     int last_frame_in_sequence = 0;
 
-    if (data == NULL) {
+    if (!data) {
         /* push end of sequence if not already signalled */
         if (!p_dirac_params->eos_signalled) {
             dirac_encoder_end_sequence( p_dirac_params->p_encoder );
@@ -358,7 +358,7 @@ static int libdirac_encode_frame(AVCodec
     p_next_output_frame =
           ff_dirac_schro_queue_pop(&p_dirac_params->enc_frame_queue);
 
-    if (p_next_output_frame == NULL)
+    if (!p_next_output_frame)
         return 0;
 
     memcpy(frame, p_next_output_frame->p_encbuf, p_next_output_frame->size);

Modified: trunk/libavcodec/libschroedingerdec.c
==============================================================================
--- trunk/libavcodec/libschroedingerdec.c	Sat Aug 15 11:12:58 2009	(r19646)
+++ trunk/libavcodec/libschroedingerdec.c	Sat Aug 15 13:02:50 2009	(r19647)
@@ -196,7 +196,7 @@ static void libschroedinger_handle_first
     avccontext->time_base.den = p_schro_params->format->frame_rate_numerator;
     avccontext->time_base.num = p_schro_params->format->frame_rate_denominator;
 
-    if (p_schro_params->dec_pic.data[0] == NULL)
+    if (!p_schro_params->dec_pic.data[0])
     {
         avpicture_alloc(&p_schro_params->dec_pic,
                         avccontext->pix_fmt,
@@ -226,7 +226,7 @@ static int libschroedinger_decode_frame(
     *data_size = 0;
 
     FfmpegSchroParseContextInit (&parse_ctx, buf, buf_size);
-    if (buf_size == 0) {
+    if (!buf_size) {
         if (!p_schro_params->eos_signalled) {
             state = schro_decoder_push_end_of_stream(decoder);
             p_schro_params->eos_signalled = 1;
@@ -300,7 +300,7 @@ static int libschroedinger_decode_frame(
     /* Grab next frame to be returned from the top of the queue. */
     frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue);
 
-    if (frame != NULL) {
+    if (frame) {
         memcpy (p_schro_params->dec_pic.data[0],
                 frame->components[0].data,
                 frame->components[0].length);

Modified: trunk/libavcodec/libschroedingerenc.c
==============================================================================
--- trunk/libavcodec/libschroedingerenc.c	Sat Aug 15 11:12:58 2009	(r19646)
+++ trunk/libavcodec/libschroedingerenc.c	Sat Aug 15 13:02:50 2009	(r19647)
@@ -145,7 +145,7 @@ static int libschroedinger_encode_init(A
 
     avccontext->coded_frame = &p_schro_params->picture;
 
-    if (avccontext->gop_size == 0){
+    if (!avccontext->gop_size) {
         schro_encoder_setting_set_double (p_schro_params->encoder,
                                           "gop_structure",
                                           SCHRO_ENCODER_GOP_INTRA_ONLY);
@@ -164,7 +164,7 @@ static int libschroedinger_encode_init(A
 
     /* FIXME - Need to handle SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY. */
     if (avccontext->flags & CODEC_FLAG_QSCALE) {
-        if (avccontext->global_quality == 0) {
+        if (!avccontext->global_quality) {
             /* lossless coding */
             schro_encoder_setting_set_double (p_schro_params->encoder,
                                           "rate_control",
@@ -366,7 +366,7 @@ static int libschroedinger_encode_frame(
     p_frame_output =
                ff_dirac_schro_queue_pop (&p_schro_params->enc_frame_queue);
 
-    if (p_frame_output == NULL)
+    if (!p_frame_output)
         return 0;
 
     memcpy(frame, p_frame_output->p_encbuf, p_frame_output->size);



More information about the ffmpeg-cvslog mailing list