Guest User

Untitled

a guest
Mar 20th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. From 4ea1953b2ceff4ab3be57caf730c9d99a4192238 Mon Sep 17 00:00:00 2001
  2. From: Gagandeep Singh <deepgagan231197@gmail.com>
  3. Date: Tue, 20 Mar 2018 17:54:06 +0530
  4. Subject: [FFmpeg][PATCH] lavc/cfhd: alpha decoding added
  5.  
  6. some post processing was required
  7. ---
  8. libavcodec/cfhd.c | 17 +++++++++++++++++
  9. 1 file changed, 17 insertions(+)
  10.  
  11. diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
  12. index a064cd1599..a950dc0f28 100644
  13. --- a/libavcodec/cfhd.c
  14. +++ b/libavcodec/cfhd.c
  15. @@ -94,6 +94,21 @@ static inline int dequant_and_decompand(int level, int quantisation)
  16. FFSIGN(level) * quantisation;
  17. }
  18.  
  19. +static inline void process_alpha(int16_t *alpha, int width)
  20. +{
  21. + int i, channel;
  22. + for (i = 0; i < width; i++) {
  23. + channel = alpha[i];
  24. + channel -= 16 << 4;
  25. + channel <<= 8;
  26. + channel -= 128;
  27. + channel /= 223;
  28. + channel = FFMIN(channel, (1 << 12) - 1);
  29. + channel = FFMAX(channel, 0);
  30. + alpha[i] = channel;
  31. + }
  32. +}
  33. +
  34. static inline void filter(int16_t *output, ptrdiff_t out_stride,
  35. int16_t *low, ptrdiff_t low_stride,
  36. int16_t *high, ptrdiff_t high_stride,
  37. @@ -792,6 +807,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
  38. high = s->plane[plane].l_h[7];
  39. for (i = 0; i < lowpass_height * 2; i++) {
  40. horiz_filter_clip(dst, low, high, lowpass_width, s->bpc);
  41. + if (act_plane == 3)
  42. + process_alpha(dst, lowpass_width * 2);
  43. low += lowpass_width;
  44. high += lowpass_width;
  45. dst += pic->linesize[act_plane] / 2;
  46. --
  47. 2.14.1
Add Comment
Please, Sign In to add comment