[FFmpeg-soc] [soc]: r994 - in dirac/libavcodec: dirac.c dirac_wavelet.c
marco
subversion at mplayerhq.hu
Sun Aug 19 00:51:12 CEST 2007
Author: marco
Date: Sun Aug 19 00:51:12 2007
New Revision: 994
Log:
fix interfaces so the splitup actually works
Modified:
dirac/libavcodec/dirac.c
dirac/libavcodec/dirac_wavelet.c
Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c (original)
+++ dirac/libavcodec/dirac.c Sun Aug 19 00:51:12 2007
@@ -1586,18 +1586,22 @@ static void decode_component(DiracContex
* @param coeffs coefficients to transform
* @return returns 0 on succes, otherwise -1
*/
-static int dirac_idwt(DiracContext *s, int16_t *coeffs) {
+int dirac_idwt(DiracContext *s, int16_t *coeffs) {
int level;
+ int width, height;
for (level = 1; level <= s->frame_decoding.wavelet_depth; level++) {
+ width = subband_width(s, level);
+ height = subband_height(s, level);
+
switch(s->wavelet_idx) {
case 0:
dprintf(s->avctx, "Deslauriers-Debuc (9,5) IDWT\n");
- dirac_subband_idwt_95(s, coeffs, level);
+ dirac_subband_idwt_95(&s->avctx, width, height, s->padded_width, coeffs, level);
break;
case 1:
dprintf(s->avctx, "LeGall (5,3) IDWT\n");
- dirac_subband_idwt_53(s, coeffs, level);
+ dirac_subband_idwt_53(&s->avctx, width, height, s->padded_width, coeffs, level);
break;
default:
av_log(s->avctx, AV_LOG_INFO, "unknown IDWT index: %d\n",
@@ -1614,12 +1618,16 @@ static int dirac_idwt(DiracContext *s, i
* @param coeffs coefficients to transform
* @return returns 0 on succes, otherwise -1
*/
-static int dirac_dwt(DiracContext *s, int16_t *coeffs) {
+int dirac_dwt(DiracContext *s, int16_t *coeffs) {
int level;
+ int width, height;
/* XXX: make depth configurable. */
- for (level = s->frame_decoding.wavelet_depth; level >= 1; level--)
- dirac_subband_dwt_95(s, coeffs, level);
+ for (level = s->frame_decoding.wavelet_depth; level >= 1; level--) {
+ width = subband_width(s, level);
+ height = subband_height(s, level);
+ dirac_subband_dwt_95(&s->avctx, width, height, s->padded_width, coeffs, level);
+ }
return 0;
}
Modified: dirac/libavcodec/dirac_wavelet.c
==============================================================================
--- dirac/libavcodec/dirac_wavelet.c (original)
+++ dirac/libavcodec/dirac_wavelet.c Sun Aug 19 00:51:12 2007
@@ -20,7 +20,7 @@
*/
/**
- * @file dirac.c
+ * @file dirac_wavelet.c
* Dirac Decoder
* @author Marco Gerards <marco at gnu.org>
*/
@@ -36,17 +36,16 @@
* @param synth output buffer
* @param level subband level
*/
-static void dirac_subband_idwt_interleave(DiracContext *s, int16_t *data,
+void dirac_subband_idwt_interleave(int16_t *data, int width,
+ int height, int padded_width,
int16_t *synth, int level) {
int x, y;
- int width = subband_width(s, level);
- int height = subband_height(s, level);
int synth_width = width << 1;
int16_t *synth_line = synth;
int16_t *line_ll = data;
- int16_t *line_lh = data + height * s->padded_width;
+ int16_t *line_lh = data + height * padded_width;
int16_t *line_hl = data + width;
- int16_t *line_hh = data + height * s->padded_width + width;
+ int16_t *line_hh = data + height * padded_width + width;
/* Interleave the coefficients. */
for (y = 0; y < height; y++) {
@@ -58,24 +57,24 @@ static void dirac_subband_idwt_interleav
}
synth_line += synth_width << 1;
- line_ll += s->padded_width;
- line_lh += s->padded_width;
- line_hl += s->padded_width;
- line_hh += s->padded_width;
+ line_ll += padded_width;
+ line_lh += padded_width;
+ line_hl += padded_width;
+ line_hh += padded_width;
}
}
-static void dirac_subband_dwt_deinterleave(DiracContext *s, int16_t *data,
+void dirac_subband_dwt_deinterleave(int16_t *data,
+ int width, int height,
+ int padded_width,
int16_t *synth, int level) {
int x, y;
- int width = subband_width(s, level);
- int height = subband_height(s, level);
int synth_width = width << 1;
int16_t *synth_line = synth;
int16_t *line_ll = data;
- int16_t *line_lh = data + height * s->padded_width;
+ int16_t *line_lh = data + height * padded_width;
int16_t *line_hl = data + width;
- int16_t *line_hh = data + height * s->padded_width + width;
+ int16_t *line_hh = data + height * padded_width + width;
/* Deinterleave the coefficients. */
for (y = 0; y < height; y++) {
@@ -87,14 +86,13 @@ static void dirac_subband_dwt_deinterlea
}
synth_line += synth_width << 1;
- line_ll += s->padded_width;
- line_lh += s->padded_width;
- line_hl += s->padded_width;
- line_hh += s->padded_width;
+ line_ll += padded_width;
+ line_lh += padded_width;
+ line_hl += padded_width;
+ line_hh += padded_width;
}
}
-
/**
* IDWT transform (5,3) for a specific subband
*
@@ -102,29 +100,28 @@ static void dirac_subband_dwt_deinterlea
* @param level level of the current transform
* @return 0 when successful, otherwise -1 is returned
*/
-static int dirac_subband_idwt_53(DiracContext *s,
+int dirac_subband_idwt_53(AVCodecContext *avctx, int width, int height,
+ int padded_width,
int16_t *data, int level) {
int16_t *synth, *synthline;
int x, y;
- int width = subband_width(s, level);
- int height = subband_height(s, level);
int synth_width = width << 1;
int synth_height = height << 1;
START_TIMER
- if (avcodec_check_dimensions(s->avctx, synth_width, synth_height)) {
- av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ if (avcodec_check_dimensions(avctx, synth_width, synth_height)) {
+ av_log(avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
return -1;
}
synth = av_malloc(synth_width * synth_height * sizeof(int16_t));
if (!synth) {
- av_log(s->avctx, AV_LOG_ERROR, "av_malloc() failed\n");
+ av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
return -1;
}
- dirac_subband_idwt_interleave(s, data, synth, level);
+ dirac_subband_idwt_interleave(data, width, height, padded_width, synth, level);
/* Vertical synthesis: Lifting stage 1. */
synthline = synth;
@@ -206,7 +203,7 @@ START_TIMER
for (x = 0; x < synth_width; x++)
data[x] = (synthline[x] + 1) >> 1;
synthline += synth_width;
- data += s->padded_width;
+ data += padded_width;
}
STOP_TIMER("idwt53")
@@ -223,25 +220,24 @@ STOP_TIMER("idwt53")
* @param level level of the current transform
* @return 0 when successful, otherwise -1 is returned
*/
-static int dirac_subband_dwt_53(DiracContext *s,
+int dirac_subband_dwt_53(AVCodecContext *avctx, int width, int height,
+ int padded_width,
int16_t *data, int level) {
int16_t *synth, *synthline, *dataline;
int x, y;
- int width = subband_width(s, level);
- int height = subband_height(s, level);
int synth_width = width << 1;
int synth_height = height << 1;
START_TIMER
- if (avcodec_check_dimensions(s->avctx, synth_width, synth_height)) {
- av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ if (avcodec_check_dimensions(avctx, synth_width, synth_height)) {
+ av_log(avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
return -1;
}
synth = av_malloc(synth_width * synth_height * sizeof(int16_t));
if (!synth) {
- av_log(s->avctx, AV_LOG_ERROR, "av_malloc() failed\n");
+ av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
return -1;
}
@@ -253,7 +249,7 @@ START_TIMER
for (x = 0; x < synth_width; x++)
synthline[x] = dataline[x] << 1;
synthline += synth_width;
- dataline += s->padded_width;
+ dataline += padded_width;
}
/* Horizontal synthesis. */
@@ -283,7 +279,7 @@ START_TIMER
+ 2) >> 2;
synthline += synth_width;
- dataline += s->padded_width;
+ dataline += padded_width;
}
/* Vertical synthesis: Lifting stage 2. */
@@ -331,7 +327,7 @@ START_TIMER
}
- dirac_subband_dwt_deinterleave(s, data, synth, level);
+ dirac_subband_dwt_deinterleave(data, width, height, padded_width, synth, level);
STOP_TIMER("dwt53")
@@ -348,29 +344,28 @@ STOP_TIMER("dwt53")
* @param level level of the current transform
* @return 0 when successful, otherwise -1 is returned
*/
-static int dirac_subband_idwt_95(DiracContext *s,
+int dirac_subband_idwt_95(AVCodecContext *avctx, int width,
+ int height, int padded_width,
int16_t *data, int level) {
int16_t *synth, *synthline;
int x, y;
- int width = subband_width(s, level);
- int height = subband_height(s, level);
int synth_width = width << 1;
int synth_height = height << 1;
START_TIMER
- if (avcodec_check_dimensions(s->avctx, synth_width, synth_height)) {
- av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ if (avcodec_check_dimensions(avctx, synth_width, synth_height)) {
+ av_log(avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
return -1;
}
synth = av_malloc(synth_width * synth_height * sizeof(int16_t));
if (!synth) {
- av_log(s->avctx, AV_LOG_ERROR, "av_malloc() failed\n");
+ av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
return -1;
}
- dirac_subband_idwt_interleave(s, data, synth, level);
+ dirac_subband_idwt_interleave(data, width, height, padded_width, synth, level);
/* Vertical synthesis: Lifting stage 1. */
synthline = synth;
@@ -475,7 +470,7 @@ START_TIMER
for (x = 0; x < synth_width; x++)
data[x] = (synthline[x] + 1) >> 1;
synthline += synth_width;
- data += s->padded_width;
+ data += padded_width;
}
STOP_TIMER("idwt95")
@@ -492,25 +487,24 @@ STOP_TIMER("idwt95")
* @param level level of the current transform
* @return 0 when successful, otherwise -1 is returned
*/
-static int dirac_subband_dwt_95(DiracContext *s,
- int16_t *data, int level) {
+int dirac_subband_dwt_95(AVCodecContext *avctx, int width, int height,
+ int padded_width,
+ int16_t *data, int level) {
int16_t *synth, *synthline, *dataline;
int x, y;
- int width = subband_width(s, level);
- int height = subband_height(s, level);
int synth_width = width << 1;
int synth_height = height << 1;
START_TIMER
- if (avcodec_check_dimensions(s->avctx, synth_width, synth_height)) {
- av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ if (avcodec_check_dimensions(avctx, synth_width, synth_height)) {
+ av_log(avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
return -1;
}
synth = av_malloc(synth_width * synth_height * sizeof(int16_t));
if (!synth) {
- av_log(s->avctx, AV_LOG_ERROR, "av_malloc() failed\n");
+ av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
return -1;
}
@@ -522,7 +516,7 @@ START_TIMER
for (x = 0; x < synth_width; x++)
synthline[x] = dataline[x] << 1;
synthline += synth_width;
- dataline += s->padded_width;
+ dataline += padded_width;
}
/* Horizontal synthesis. */
@@ -621,7 +615,7 @@ START_TIMER
+ synthline[x + synth_width]
+ 2) >> 2;
- dirac_subband_dwt_deinterleave(s, data, synth, level);
+ dirac_subband_dwt_deinterleave(data, width, height, padded_width, synth, level);
STOP_TIMER("dwt95")
More information about the FFmpeg-soc
mailing list