aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2025-07-17 13:19:55 +0900
committerLynne <dev@lynne.ee>2025-08-08 18:29:40 +0900
commit5674879db5ea411b42e55c3906fa586f540bf637 (patch)
tree82ca63dc7c5c76ac40a172458f2da988c6d9e490
parentb2928971e82950fad80aa2f252db5cc092ab48f7 (diff)
downloadffmpeg-5674879db5ea411b42e55c3906fa586f540bf637.tar.gz
proresdsp: add idct_put_bayer
This commit adds a 12-bit DCT function to directly write to Bayer images. Will be used in the following commit.
-rw-r--r--libavcodec/proresdsp.c17
-rw-r--r--libavcodec/proresdsp.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
index 17726a56e0..a4921128f7 100644
--- a/libavcodec/proresdsp.c
+++ b/libavcodec/proresdsp.c
@@ -99,6 +99,15 @@ static inline void put_pixel(uint16_t *dst, ptrdiff_t linesize, const int16_t *i
}
}
+static inline void put_pixel_bayer_12(uint16_t *dst, ptrdiff_t linesize,
+ const int16_t *in)
+{
+ for (int y = 0; y < 8; y++, dst += linesize) {
+ for (int x = 0; x < 8; x++)
+ dst[x*2] = CLIP_12(in[(y << 3) + x]) << 4;
+ }
+}
+
static void put_pixels_10(uint16_t *dst, ptrdiff_t linesize, const int16_t *in)
{
put_pixel(dst, linesize, in, 10);
@@ -121,6 +130,13 @@ static void prores_idct_put_12_c(uint16_t *out, ptrdiff_t linesize, int16_t *blo
put_pixels_12(out, linesize >> 1, block);
}
+static void prores_idct_put_bayer_12_c(uint16_t *out, ptrdiff_t linesize,
+ int16_t *block, const int16_t *qmat)
+{
+ prores_idct_12(block, qmat);
+ put_pixel_bayer_12(out, linesize << 1, block);
+}
+
av_cold void ff_proresdsp_init(ProresDSPContext *dsp, int bits_per_raw_sample)
{
if (bits_per_raw_sample == 10) {
@@ -129,6 +145,7 @@ av_cold void ff_proresdsp_init(ProresDSPContext *dsp, int bits_per_raw_sample)
} else {
av_assert1(bits_per_raw_sample == 12);
dsp->idct_put = prores_idct_put_12_c;
+ dsp->idct_put_bayer = prores_idct_put_bayer_12_c;
dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
}
diff --git a/libavcodec/proresdsp.h b/libavcodec/proresdsp.h
index ef09d86380..f8b57d7e87 100644
--- a/libavcodec/proresdsp.h
+++ b/libavcodec/proresdsp.h
@@ -30,6 +30,7 @@ typedef struct ProresDSPContext {
int idct_permutation_type;
uint8_t idct_permutation[64];
void (*idct_put)(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat);
+ void (*idct_put_bayer)(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat);
} ProresDSPContext;
void ff_proresdsp_init(ProresDSPContext *dsp, int bits_per_raw_sample);