|
|
|
@ -54,7 +54,6 @@ typedef struct { |
|
|
|
|
uint8_t *non_b_qp_table; |
|
|
|
|
int non_b_qp_alloc_size; |
|
|
|
|
int use_bframe_qp; |
|
|
|
|
|
|
|
|
|
} USPPContext; |
|
|
|
|
|
|
|
|
|
#define OFFSET(x) offsetof(USPPContext, x) |
|
|
|
@ -74,7 +73,6 @@ static const AVClass uspp_class = { |
|
|
|
|
.category = AV_CLASS_CATEGORY_FILTER, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//===========================================================================//
|
|
|
|
|
DECLARE_ALIGNED(8, static const uint8_t, dither)[8][8] = { |
|
|
|
|
{ 0*4, 48*4, 12*4, 60*4, 3*4, 51*4, 15*4, 63*4, }, |
|
|
|
|
{ 32*4, 16*4, 44*4, 28*4, 35*4, 19*4, 47*4, 31*4, }, |
|
|
|
@ -170,7 +168,7 @@ static void store_slice_c(uint8_t *dst, int16_t *src, |
|
|
|
|
temp = ((src[x + y * src_stride + pos] << log2_scale) + d[pos]) >> 8; \
|
|
|
|
|
if (temp & 0x100) temp = ~(temp >> 31); \
|
|
|
|
|
dst[x + y * dst_stride + pos] = temp; \
|
|
|
|
|
} while (0); |
|
|
|
|
} while (0) |
|
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) { |
|
|
|
|
const uint8_t *d = dither[y&7]; |
|
|
|
@ -205,6 +203,7 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3], |
|
|
|
|
{ |
|
|
|
|
int x, y, i, j; |
|
|
|
|
const int count = 1<<p->log2_count; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) { |
|
|
|
|
int is_chroma = !!i; |
|
|
|
|
int w = width >> is_chroma; |
|
|
|
@ -216,6 +215,7 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3], |
|
|
|
|
continue; |
|
|
|
|
for (y = 0; y < h; y++) { |
|
|
|
|
int index = block + block * stride + y * stride; |
|
|
|
|
|
|
|
|
|
memcpy(p->src[i] + index, src[i] + y * src_stride[i], w ); |
|
|
|
|
for (x = 0; x < block; x++) { |
|
|
|
|
p->src[i][index - x - 1] = p->src[i][index + x ]; |
|
|
|
@ -307,8 +307,7 @@ static int config_input(AVFilterLink *inlink) |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
AVCodec *enc = avcodec_find_encoder(AV_CODEC_ID_SNOW); |
|
|
|
|
if(!enc) |
|
|
|
|
{ |
|
|
|
|
if (!enc) { |
|
|
|
|
av_log(ctx, AV_LOG_ERROR, "SNOW encoder not found.\n"); |
|
|
|
|
return AVERROR(EINVAL); |
|
|
|
|
} |
|
|
|
@ -425,7 +424,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
|
|
|
|
out->height = in->height; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
filter(uspp , out->data , in->data , out->linesize , in->linesize , inlink->w , inlink->h , qp_table , qp_stride); |
|
|
|
|
filter(uspp, out->data, in->data, out->linesize, in->linesize, |
|
|
|
|
inlink->w, inlink->h, qp_table, qp_stride); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|