SHARE
TWEET

Untitled

a guest Nov 13th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. From f24a5dc804fa7250a362c8f72498ccda691e93bd Mon Sep 17 00:00:00 2001
  2. From: Kieran Kunhya <kieran@kunhya.com>
  3. Date: Fri, 28 Sep 2018 21:45:24 +0100
  4. Subject: [PATCH] Base of prores 12-bit
  5.  
  6. ---
  7. libavcodec/proresdec2.c  | 4 ++--
  8.  libavcodec/proresdsp.c   | 4 +++-
  9.  libavcodec/proresdsp.h   | 2 +-
  10.  libavcodec/simple_idct.c | 8 ++++----
  11.  4 files changed, 10 insertions(+), 8 deletions(-)
  12.  
  13. diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
  14. index d818e5d8da..fca7f58926 100644
  15. --- a/libavcodec/proresdec2.c
  16. +++ b/libavcodec/proresdec2.c
  17. @@ -115,7 +115,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
  18.      if (ctx->alpha_info) {
  19.          avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 : AV_PIX_FMT_YUVA422P10;
  20.      } else {
  21. -        avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10;
  22. +        avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P12 : AV_PIX_FMT_YUV422P12;
  23.      }
  24.  
  25.      avctx->color_primaries = buf[14];
  26. @@ -564,7 +564,7 @@ static int decode_slice_thread(AVCodecContext *avctx, void *arg, int jobnr, int
  27.          chroma_stride = pic->linesize[1] << 1;
  28.      }
  29.  
  30. -    if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10) {
  31. +    if (avctx->pix_fmt == AV_PIX_FMT_YUV444P12 || avctx->pix_fmt == AV_PIX_FMT_YUVA444P10) {
  32.          mb_x_shift = 5;
  33.          log2_chroma_blocks_per_mb = 2;
  34.      } else {
  35. diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
  36. index 5b5ada21fe..8e1357ad52 100644
  37. --- a/libavcodec/proresdsp.c
  38. +++ b/libavcodec/proresdsp.c
  39. @@ -28,7 +28,7 @@
  40.  #include "simple_idct.h"
  41.  
  42.  #define BIAS     (1 << (PRORES_BITS_PER_SAMPLE - 1))           ///< bias value for converting signed pixels into unsigned ones
  43. -#define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 8))           ///< minimum value for clipping resulting pixels
  44. +#define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 10))           ///< minimum value for clipping resulting pixels
  45.  #define CLIP_MAX (1 << PRORES_BITS_PER_SAMPLE) - CLIP_MIN - 1  ///< maximum value for clipping resulting pixels
  46.  
  47.  #define CLIP(x) (av_clip((x), CLIP_MIN, CLIP_MAX))
  48. @@ -60,8 +60,10 @@ av_cold void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
  49.      dsp->idct_put = prores_idct_put_c;
  50.      dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
  51.  
  52. +#if 0
  53.      if (ARCH_X86)
  54.          ff_proresdsp_init_x86(dsp, avctx);
  55. +#endif
  56.  
  57.      ff_init_scantable_permutation(dsp->idct_permutation,
  58.                                    dsp->idct_permutation_type);
  59. diff --git a/libavcodec/proresdsp.h b/libavcodec/proresdsp.h
  60. index 558fae53bf..6a84476a7f 100644
  61. --- a/libavcodec/proresdsp.h
  62. +++ b/libavcodec/proresdsp.h
  63. @@ -27,7 +27,7 @@
  64.  #include <stdint.h>
  65.  #include "avcodec.h"
  66.  
  67. -#define PRORES_BITS_PER_SAMPLE 10 ///< output precision of prores decoder
  68. +#define PRORES_BITS_PER_SAMPLE 12 ///< output precision of prores decoder
  69.  
  70.  typedef struct ProresDSPContext {
  71.      int idct_permutation_type;
  72. diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c
  73. index 78b29c0fe3..a9de58c90f 100644
  74. --- a/libavcodec/simple_idct.c
  75. +++ b/libavcodec/simple_idct.c
  76. @@ -241,13 +241,13 @@ void ff_prores_idct(int16_t *block, const int16_t *qmat)
  77.      int i;
  78.  
  79.      for (i = 0; i < 64; i++)
  80. -        block[i] *= qmat[i];
  81. +        block[i] *= qmat[i]; // FIXME do this in the codec
  82.  
  83.      for (i = 0; i < 8; i++)
  84. -        idctRowCondDC_extrashift_10(block + i*8, 2);
  85. +        idctRowCondDC_int16_12bit(block + i*8, 0);
  86.  
  87.      for (i = 0; i < 8; i++) {
  88. -        block[i] += 8192;
  89. -        idctSparseCol_extrashift_10(block + i);
  90. +        block[i] += 8192; // FIXME: do this in the codec
  91. +        idctSparseCol_int16_12bit(block + i);
  92.      }
  93.  }
  94. --
  95. 2.11.0.windows.1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top