On Sat, 25 May 2013, Kostya Shishkov wrote:

---
One of my samples uses 4x4 Haar transform, another one has 1D Haar transforms,
so why not implement them all?
---
libavcodec/indeo4.c  |   14 ++--
libavcodec/ivi_dsp.c |  204 ++++++++++++++++++++++++++++++++++++++++++++++++--
libavcodec/ivi_dsp.h |   89 ++++++++++++++++++++++
3 files changed, 294 insertions(+), 13 deletions(-)

diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c
index 8820a2c..eb34688 100644
--- a/libavcodec/indeo4.c
+++ b/libavcodec/indeo4.c
@@ -56,8 +56,8 @@ static const struct {
    int             is_2d_trans;
} transforms[18] = {
    { ff_ivi_inverse_haar_8x8,  ff_ivi_dc_haar_2d,       1 },
-    { NULL, NULL, 0 }, /* inverse Haar 8x1 */
-    { NULL, NULL, 0 }, /* inverse Haar 1x8 */
+    { ff_ivi_row_haar8,         ff_ivi_dc_haar_2d,       0 },
+    { ff_ivi_col_haar8,         ff_ivi_dc_haar_2d,       0 },
    { ff_ivi_put_pixels_8x8,    ff_ivi_put_dc_pixel_8x8, 1 },
    { ff_ivi_inverse_slant_8x8, ff_ivi_dc_slant_2d,      1 },
    { ff_ivi_row_slant8,        ff_ivi_dc_row_slant,     1 },
@@ -65,13 +65,13 @@ static const struct {
    { NULL, NULL, 0 }, /* inverse DCT 8x8 */
    { NULL, NULL, 0 }, /* inverse DCT 8x1 */
    { NULL, NULL, 0 }, /* inverse DCT 1x8 */
-    { NULL, NULL, 0 }, /* inverse Haar 4x4 */
+    { ff_ivi_inverse_haar_4x4,  ff_ivi_dc_haar_2d,       1 },
    { ff_ivi_inverse_slant_4x4, ff_ivi_dc_slant_2d,      1 },
    { NULL, NULL, 0 }, /* no transform 4x4 */
-    { NULL, NULL, 0 }, /* inverse Haar 1x4 */
-    { NULL, NULL, 0 }, /* inverse Haar 4x1 */
-    { NULL, NULL, 0 }, /* inverse slant 1x4 */
-    { NULL, NULL, 0 }, /* inverse slant 4x1 */
+    { ff_ivi_row_haar4,         ff_ivi_dc_haar_2d,       0 },
+    { ff_ivi_col_haar4,         ff_ivi_dc_haar_2d,       0 },
+    { ff_ivi_row_slant4,        ff_ivi_dc_row_slant,     0 },
+    { ff_ivi_col_slant4,        ff_ivi_dc_col_slant,     0 },
    { NULL, NULL, 0 }, /* inverse DCT 4x4 */
};

diff --git a/libavcodec/ivi_dsp.c b/libavcodec/ivi_dsp.c
index f5efa65..bd1f523 100644
--- a/libavcodec/ivi_dsp.c
+++ b/libavcodec/ivi_dsp.c
@@ -248,12 +248,14 @@ void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, 
uint8_t *dst,
    d8 = COMPENSATE(t8); }

/** inverse 4-point Haar transform */
-#define INV_HAAR4(s1, s3, s5, s7) {\
-    HAAR_BFLY(s1, s5);  HAAR_BFLY(s1, s3);  HAAR_BFLY(s5, s7);\
-    s1 = COMPENSATE(s1);\
-    s3 = COMPENSATE(s3);\
-    s5 = COMPENSATE(s5);\
-    s7 = COMPENSATE(s7); }
+#define INV_HAAR4(s1, s3, s5, s7, d1, d2, d3, d4, t0, t1, t2, t3, t4) {\
+    IVI_HAAR_BFLY(s1, s3, t0, t1, t4);\
+    IVI_HAAR_BFLY(t0, s5, t2, t3, t4);\
+    d1 = COMPENSATE(t2);\
+    d2 = COMPENSATE(t3);\
+    IVI_HAAR_BFLY(t1, s7, t2, t3, t4);\
+    d3 = COMPENSATE(t2);\
+    d4 = COMPENSATE(t3); }

The commit message could explain that the existing INV_HAAR4 macro was unused (and incomplete/wrong?) which is why it is changed here.

The patch in itself looks good.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to