[1/3] idct: Move jpeg ref idct put/add wrappers to the only place they are used

Message ID 1456251187-16119-1-git-send-email-diego@biurrun.de
State New
Headers show

Commit Message

Diego Biurrun Feb. 23, 2016, 6:13 p.m.
---
 libavcodec/dct.h     |  2 --
 libavcodec/idctdsp.c | 16 ++++++++++++++--
 libavcodec/jrevdct.c | 12 ------------
 3 files changed, 14 insertions(+), 16 deletions(-)

Comments

Luca Barbato Feb. 23, 2016, 7:36 p.m. | #1
On 23/02/16 19:13, Diego Biurrun wrote:
> ---
>  libavcodec/dct.h     |  2 --
>  libavcodec/idctdsp.c | 16 ++++++++++++++--
>  libavcodec/jrevdct.c | 12 ------------
>  3 files changed, 14 insertions(+), 16 deletions(-)

The set seems ok, oracle might confirm, I'll try on macosx if Vittorio
doesn't beat me at it.

lu
Anton Khirnov Feb. 24, 2016, 9:01 a.m. | #2
Quoting Diego Biurrun (2016-02-23 19:13:05)
> ---
>  libavcodec/dct.h     |  2 --
>  libavcodec/idctdsp.c | 16 ++++++++++++++--
>  libavcodec/jrevdct.c | 12 ------------
>  3 files changed, 14 insertions(+), 16 deletions(-)
> 

This does not strike me as an improvement. The function logically belong
where they are.
Luca Barbato Feb. 24, 2016, 2:44 p.m. | #3
On 24/02/16 10:01, Anton Khirnov wrote:
> Quoting Diego Biurrun (2016-02-23 19:13:05)
>> ---
>>  libavcodec/dct.h     |  2 --
>>  libavcodec/idctdsp.c | 16 ++++++++++++++--
>>  libavcodec/jrevdct.c | 12 ------------
>>  3 files changed, 14 insertions(+), 16 deletions(-)
>>
> 
> This does not strike me as an improvement. The function logically belong
> where they are.

Then Vittorio's patch is fine.

lu

Patch

diff --git a/libavcodec/dct.h b/libavcodec/dct.h
index 4a31f54..3fd4e27 100644
--- a/libavcodec/dct.h
+++ b/libavcodec/dct.h
@@ -59,7 +59,5 @@  void ff_fdct248_islow_8(int16_t *data);
 void ff_fdct248_islow_10(int16_t *data);
 
 void ff_j_rev_dct(int16_t *data);
-void ff_jref_idct_put(uint8_t *dest, int line_size, int16_t *block);
-void ff_jref_idct_add(uint8_t *dest, int line_size, int16_t *block);
 
 #endif /* AVCODEC_DCT_H */
diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
index a9b8727..31b19e3 100644
--- a/libavcodec/idctdsp.c
+++ b/libavcodec/idctdsp.c
@@ -144,6 +144,18 @@  static void add_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
     }
 }
 
+static void j_rev_idct_put(uint8_t *dest, int line_size, int16_t *block)
+{
+    ff_j_rev_dct(block);
+    ff_put_pixels_clamped(block, dest, line_size);
+}
+
+static void j_rev_idct_add(uint8_t *dest, int line_size, int16_t *block)
+{
+    ff_j_rev_dct(block);
+    ff_add_pixels_clamped(block, dest, line_size);
+}
+
 av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
 {
     const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
@@ -154,8 +166,8 @@  av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
         c->idct      = ff_simple_idct_10;
         c->perm_type = FF_IDCT_PERM_NONE;
     } else if (avctx->idct_algo == FF_IDCT_INT) {
-        c->idct_put  = ff_jref_idct_put;
-        c->idct_add  = ff_jref_idct_add;
+        c->idct_put  = j_rev_idct_put;
+        c->idct_add  = j_rev_idct_add;
         c->idct      = ff_j_rev_dct;
         c->perm_type = FF_IDCT_PERM_LIBMPEG2;
 #if CONFIG_FAANIDCT
diff --git a/libavcodec/jrevdct.c b/libavcodec/jrevdct.c
index 8261269..3730ff2 100644
--- a/libavcodec/jrevdct.c
+++ b/libavcodec/jrevdct.c
@@ -942,15 +942,3 @@  void ff_j_rev_dct(DCTBLOCK data)
     dataptr++;                  /* advance pointer to next column */
   }
 }
-
-void ff_jref_idct_put(uint8_t *dest, int line_size, int16_t *block)
-{
-    ff_j_rev_dct(block);
-    ff_put_pixels_clamped(block, dest, line_size);
-}
-
-void ff_jref_idct_add(uint8_t *dest, int line_size, int16_t *block)
-{
-    ff_j_rev_dct(block);
-    ff_add_pixels_clamped(block, dest, line_size);
-}