You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
lavc/cfhd: add alpha decompanding in rgba12
Alpha decompanding curve added to post process the decoded alpha channel. Fixes ticket #6265.
This commit is contained in:
committed by
Paul B Mahol
parent
59347c2474
commit
c64c97b972
@@ -37,6 +37,9 @@
|
|||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "cfhd.h"
|
#include "cfhd.h"
|
||||||
|
|
||||||
|
#define ALPHA_COMPAND_DC_OFFSET 256
|
||||||
|
#define ALPHA_COMPAND_GAIN 9400
|
||||||
|
|
||||||
enum CFHDParam {
|
enum CFHDParam {
|
||||||
ChannelCount = 12,
|
ChannelCount = 12,
|
||||||
SubbandCount = 14,
|
SubbandCount = 14,
|
||||||
@@ -94,6 +97,20 @@ static inline int dequant_and_decompand(int level, int quantisation)
|
|||||||
FFSIGN(level) * quantisation;
|
FFSIGN(level) * quantisation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void process_alpha(int16_t *alpha, int width)
|
||||||
|
{
|
||||||
|
int i, channel;
|
||||||
|
for (i = 0; i < width; i++) {
|
||||||
|
channel = alpha[i];
|
||||||
|
channel -= ALPHA_COMPAND_DC_OFFSET;
|
||||||
|
channel <<= 3;
|
||||||
|
channel *= ALPHA_COMPAND_GAIN;
|
||||||
|
channel >>= 16;
|
||||||
|
channel = av_clip_uintp2(channel, 12);
|
||||||
|
alpha[i] = channel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void filter(int16_t *output, ptrdiff_t out_stride,
|
static inline void filter(int16_t *output, ptrdiff_t out_stride,
|
||||||
int16_t *low, ptrdiff_t low_stride,
|
int16_t *low, ptrdiff_t low_stride,
|
||||||
int16_t *high, ptrdiff_t high_stride,
|
int16_t *high, ptrdiff_t high_stride,
|
||||||
@@ -792,6 +809,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
high = s->plane[plane].l_h[7];
|
high = s->plane[plane].l_h[7];
|
||||||
for (i = 0; i < lowpass_height * 2; i++) {
|
for (i = 0; i < lowpass_height * 2; i++) {
|
||||||
horiz_filter_clip(dst, low, high, lowpass_width, s->bpc);
|
horiz_filter_clip(dst, low, high, lowpass_width, s->bpc);
|
||||||
|
if (act_plane == 3)
|
||||||
|
process_alpha(dst, lowpass_width * 2);
|
||||||
low += lowpass_width;
|
low += lowpass_width;
|
||||||
high += lowpass_width;
|
high += lowpass_width;
|
||||||
dst += pic->linesize[act_plane] / 2;
|
dst += pic->linesize[act_plane] / 2;
|
||||||
|
Reference in New Issue
Block a user