[FFmpeg-cvslog] psymodel: Remove wrapper functions.

Nathan Caldwell git at videolan.org
Mon May 9 04:48:13 CEST 2011


ffmpeg | branch: master | Nathan Caldwell <saintdev at gmail.com> | Fri May  6 01:19:52 2011 -0600| [b58e29857230eb59cfec4642522258a965f2c440] | committer: Alex Converse

psymodel: Remove wrapper functions.

Instead use the function pointers directly.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b58e29857230eb59cfec4642522258a965f2c440
---

 libavcodec/aacenc.c   |    6 +++---
 libavcodec/psymodel.c |   13 -------------
 libavcodec/psymodel.h |   49 ++++++++++++++++++++++---------------------------
 3 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 1b77411..92ff4b0 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -537,8 +537,8 @@ static int aac_encode_frame(AVCodecContext *avctx,
                 wi[ch].num_windows    = 1;
                 wi[ch].grouping[0]    = 1;
             } else {
-                wi[ch] = ff_psy_suggest_window(&s->psy, samples2, la, cur_channel,
-                                               ics->window_sequence[0]);
+                wi[ch] = s->psy.model->window(&s->psy, samples2, la, cur_channel,
+                                              ics->window_sequence[0]);
             }
             ics->window_sequence[1] = ics->window_sequence[0];
             ics->window_sequence[0] = wi[ch].window_type[0];
@@ -570,7 +570,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
             put_bits(&s->pb, 4, chan_el_counter[tag]++);
             for (ch = 0; ch < chans; ch++) {
                 s->cur_channel = start_ch + ch;
-                ff_psy_set_band_info(&s->psy, s->cur_channel, cpe->ch[ch].coeffs, &wi[ch]);
+                s->psy.model->analyze(&s->psy, s->cur_channel, cpe->ch[ch].coeffs, &wi[ch]);
                 s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda);
             }
             cpe->common_window = 0;
diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c
index a943ae1..fe9363c 100644
--- a/libavcodec/psymodel.c
+++ b/libavcodec/psymodel.c
@@ -45,19 +45,6 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx,
     return 0;
 }
 
-FFPsyWindowInfo ff_psy_suggest_window(FFPsyContext *ctx,
-                                      const int16_t *audio, const int16_t *la,
-                                      int channel, int prev_type)
-{
-    return ctx->model->window(ctx, audio, la, channel, prev_type);
-}
-
-void ff_psy_set_band_info(FFPsyContext *ctx, int channel,
-                          const float *coeffs, const FFPsyWindowInfo *wi)
-{
-    ctx->model->analyze(ctx, channel, coeffs, wi);
-}
-
 av_cold void ff_psy_end(FFPsyContext *ctx)
 {
     if (ctx->model->end)
diff --git a/libavcodec/psymodel.h b/libavcodec/psymodel.h
index 91eb9ae..02dc9c9 100644
--- a/libavcodec/psymodel.h
+++ b/libavcodec/psymodel.h
@@ -80,8 +80,30 @@ typedef struct FFPsyContext {
 typedef struct FFPsyModel {
     const char *name;
     int  (*init)   (FFPsyContext *apc);
+
+    /**
+     * Suggest window sequence for channel.
+     *
+     * @param ctx       model context
+     * @param audio     samples for the current frame
+     * @param la        lookahead samples (NULL when unavailable)
+     * @param channel   number of channel element to analyze
+     * @param prev_type previous window type
+     *
+     * @return suggested window information in a structure
+     */
     FFPsyWindowInfo (*window)(FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type);
+
+    /**
+     * Perform psychoacoustic analysis and set band info (threshold, energy).
+     *
+     * @param ctx     model context
+     * @param channel audio channel number
+     * @param coeffs  pointer to the transformed coefficients
+     * @param wi      window information
+     */
     void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, const FFPsyWindowInfo *wi);
+
     void (*end)    (FFPsyContext *apc);
 } FFPsyModel;
 
@@ -101,33 +123,6 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx,
                         const uint8_t **bands, const int* num_bands);
 
 /**
- * Suggest window sequence for channel.
- *
- * @param ctx       model context
- * @param audio     samples for the current frame
- * @param la        lookahead samples (NULL when unavailable)
- * @param channel   number of channel element to analyze
- * @param prev_type previous window type
- *
- * @return suggested window information in a structure
- */
-FFPsyWindowInfo ff_psy_suggest_window(FFPsyContext *ctx,
-                                      const int16_t *audio, const int16_t *la,
-                                      int channel, int prev_type);
-
-
-/**
- * Perform psychoacoustic analysis and set band info (threshold, energy).
- *
- * @param ctx     model context
- * @param channel audio channel number
- * @param coeffs  pointer to the transformed coefficients
- * @param wi      window information
- */
-void ff_psy_set_band_info(FFPsyContext *ctx, int channel, const float *coeffs,
-                          const FFPsyWindowInfo *wi);
-
-/**
  * Cleanup model context at the end.
  *
  * @param ctx model context



More information about the ffmpeg-cvslog mailing list