[03/12] libopencore-amr: Remove a useless debugging variable and commented out logging

Message ID 1302645498-12642-3-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö April 12, 2011, 9:58 p.m.
---
 libavcodec/libopencore-amr.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

Comments

Ronald Bultje April 12, 2011, 11:35 p.m. | #1
Hi,

On Tue, Apr 12, 2011 at 5:58 PM, Martin Storsjö <martin@martin.st> wrote:
> ---
>  libavcodec/libopencore-amr.c |   15 ---------------
>  1 files changed, 0 insertions(+), 15 deletions(-)
[..]
> diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
[..]
> -    /* av_log(NULL, AV_LOG_DEBUG, "amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",
> -              buf, buf_size, s->frameCount); */
[..]
> -    /* av_log(NULL, AV_LOG_DEBUG, "packet_size=%d amrData= 0x%X %X %X %X\n",
> -              packet_size, amrData[0], amrData[1], amrData[2], amrData[3]); */
[..]
> -    /* av_log(NULL, AV_LOG_DEBUG, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",

How about using av_dlog() for the useful messages?

Ronald
Martin Storsjö April 13, 2011, 8:07 a.m. | #2
On Tue, 12 Apr 2011, Ronald S. Bultje wrote:

> On Tue, Apr 12, 2011 at 5:58 PM, Martin Storsjö <martin@martin.st> wrote:
> > ---
> >  libavcodec/libopencore-amr.c |   15 ---------------
> >  1 files changed, 0 insertions(+), 15 deletions(-)
> [..]
> > diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
> [..]
> > -    /* av_log(NULL, AV_LOG_DEBUG, "amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",
> > -              buf, buf_size, s->frameCount); */
> [..]
> > -    /* av_log(NULL, AV_LOG_DEBUG, "packet_size=%d amrData= 0x%X %X %X %X\n",
> > -              packet_size, amrData[0], amrData[1], amrData[2], amrData[3]); */
> [..]
> > -    /* av_log(NULL, AV_LOG_DEBUG, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",
> 
> How about using av_dlog() for the useful messages?

Done locally.

Queued the ones that were OK and that I was able to apply, rewrote the 
last few.

// Martin

Patch

diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index 52dfe10..0e467a6 100644
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@ -71,7 +71,6 @@  static int getBitrateMode(int bitrate)
 }
 
 typedef struct AMRContext {
-    int   frameCount;
     void *decState;
     void *enstate;
     int   enc_bitrate;
@@ -81,7 +80,6 @@  static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
 {
     AMRContext *s = avctx->priv_data;
 
-    s->frameCount = 0;
     s->decState   = Decoder_Interface_init();
     if (!s->decState) {
         av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n");
@@ -117,9 +115,6 @@  static int amr_nb_decode_frame(AVCodecContext *avctx, void *data,
     enum Mode dec_mode;
     int packet_size;
 
-    /* av_log(NULL, AV_LOG_DEBUG, "amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",
-              buf, buf_size, s->frameCount); */
-
     dec_mode = (buf[0] >> 3) & 0x000F;
     packet_size = block_size[dec_mode] + 1;
 
@@ -129,9 +124,6 @@  static int amr_nb_decode_frame(AVCodecContext *avctx, void *data,
         return -1;
     }
 
-    s->frameCount++;
-    /* av_log(NULL, AV_LOG_DEBUG, "packet_size=%d amrData= 0x%X %X %X %X\n",
-              packet_size, amrData[0], amrData[1], amrData[2], amrData[3]); */
     /* call decoder */
     Decoder_Interface_Decode(s->decState, amrData, data, 0);
     *data_size = 160 * 2;
@@ -155,8 +147,6 @@  static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
 {
     AMRContext *s = avctx->priv_data;
 
-    s->frameCount = 0;
-
     if (avctx->sample_rate != 8000) {
         av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
         return -1;
@@ -207,8 +197,6 @@  static int amr_nb_encode_frame(AVCodecContext *avctx,
 
     written = Encoder_Interface_Encode(s->enstate, s->enc_bitrate, data,
                                        frame, 0);
-    /* av_log(NULL, AV_LOG_DEBUG, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",
-              written, s->enc_bitrate, frame[0] ); */
 
     return written;
 }
@@ -240,7 +228,6 @@  AVCodec ff_libopencore_amrnb_encoder = {
 #include <opencore-amrwb/if_rom.h>
 
 typedef struct AMRWBContext {
-    int    frameCount;
     void  *state;
 } AMRWBContext;
 
@@ -248,7 +235,6 @@  static av_cold int amr_wb_decode_init(AVCodecContext *avctx)
 {
     AMRWBContext *s = avctx->priv_data;
 
-    s->frameCount = 0;
     s->state      = D_IF_init();
 
     amr_decode_fix_avctx(avctx);
@@ -285,7 +271,6 @@  static int amr_wb_decode_frame(AVCodecContext *avctx, void *data,
         return -1;
     }
 
-    s->frameCount++;
     D_IF_decode(s->state, amrData, data, _good_frame);
     *data_size = 320 * 2;
     return packet_size;