---
mostly as rfc/call for testing but it should be good enough anyway
---
libavcodec/proresenc.c | 241 +++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 220 insertions(+), 21 deletions(-)
diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c
index 5a8cea8..d989f8c 100644
--- a/libavcodec/proresenc.c
+++ b/libavcodec/proresenc.c
@@ -21,6 +21,7 @@
*/
#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "dsputil.h"
#include "put_bits.h"
@@ -34,13 +35,14 @@
#define MAX_MBS_PER_SLICE 8
-#define MAX_PLANES 3 // should be increased to 4 when there's
AV_PIX_FMT_YUV444AP10
+#define MAX_PLANES 4
enum {
PRORES_PROFILE_PROXY = 0,
PRORES_PROFILE_LT,
PRORES_PROFILE_STANDARD,
PRORES_PROFILE_HQ,
+ PRORES_PROFILE_4444,
};
enum {
@@ -119,7 +121,7 @@ static const struct prores_profile {
int max_quant;
int br_tab[NUM_MB_LIMITS];
int quant;
-} prores_profile_info[4] = {
+} prores_profile_info[5] = {
{
.full_name = "proxy",
.tag = MKTAG('a', 'p', 'c', 'o'),
@@ -151,8 +153,15 @@ static const struct prores_profile {
.max_quant = 6,
.br_tab = { 1566, 1216, 1070, 950 },
.quant = QUANT_MAT_HQ,
+ },
+ {
+ .full_name = "4444",
+ .tag = MKTAG('a', 'p', '4', 'h'),
+ .min_quant = 1,
+ .max_quant = 6,
+ .br_tab = { 2350, 1828, 1600, 1425 },
+ .quant = QUANT_MAT_HQ,
}
-// for 4444 profile bitrate numbers are { 2350, 1828, 1600, 1425 }
};
#define TRELLIS_WIDTH 16
@@ -195,6 +204,7 @@ typedef struct ProresContext {
int num_planes;
int bits_per_mb;
int force_quant;
+ int alpha_bits;
char *vendor;
int quant_sel;
@@ -280,6 +290,34 @@ static void get_slice_data(ProresContext *ctx, const
uint16_t *src,
}
}
+static void get_alpha_data(ProresContext *ctx, const uint16_t *src,
+ int linesize, int x, int y, int w, int h,
+ int16_t *blocks, int mbs_per_slice, int abits)
+{
+ const int slice_width = 16 * mbs_per_slice;
+ int i, j, copy_w, copy_h;
+
+ copy_w = FFMIN(w - x, slice_width);
+ copy_h = FFMIN(h - y, 16);
+ for (i = 0; i < copy_h; i++) {
+ memcpy(blocks, src, copy_w * sizeof(*src));
+ if (abits == 8)
+ for (j = 0; j < copy_w; j++)
+ blocks[j] >>= 2;
+ else
+ for (j = 0; j < copy_w; j++)
+ blocks[j] = (blocks[j] << 6) | (blocks[j] >> 4);