NB_MODES
};
+#if FF_API_CHILD_CLASS_NEXT
static const AVClass *child_class_next(const AVClass *prev)
{
return prev ? NULL : avcodec_dct_get_class();
}
+#endif
+
+static const AVClass *child_class_iterate(void **iter)
+{
+ const AVClass *c = *iter ? NULL : avcodec_dct_get_class();
+ *iter = (void*)(uintptr_t)c;
+ return c;
+}
static void *child_next(void *obj, void *prev)
{
#define OFFSET(x) offsetof(SPPContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+#define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
static const AVOption spp_options[] = {
- { "quality", "set quality", OFFSET(log2_count), AV_OPT_TYPE_INT, {.i64 = 3}, 0, MAX_LEVEL, FLAGS },
+ { "quality", "set quality", OFFSET(log2_count), AV_OPT_TYPE_INT, {.i64 = 3}, 0, MAX_LEVEL, TFLAGS },
{ "qp", "force a constant quantizer parameter", OFFSET(qp), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, FLAGS },
{ "mode", "set thresholding mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = MODE_HARD}, 0, NB_MODES - 1, FLAGS, "mode" },
{ "hard", "hard thresholding", 0, AV_OPT_TYPE_CONST, {.i64 = MODE_HARD}, INT_MIN, INT_MAX, FLAGS, "mode" },
.option = spp_options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_FILTER,
+#if FF_API_CHILD_CLASS_NEXT
.child_class_next = child_class_next,
+#endif
+ .child_class_iterate = child_class_iterate,
.child_next = child_next,
};
int y;
for (y = 0; y < 8; y++) {
- *(uint32_t *)&dst[0 + y*linesize] += *(uint32_t *)&block[0 + y*8];
- *(uint32_t *)&dst[2 + y*linesize] += *(uint32_t *)&block[2 + y*8];
- *(uint32_t *)&dst[4 + y*linesize] += *(uint32_t *)&block[4 + y*8];
- *(uint32_t *)&dst[6 + y*linesize] += *(uint32_t *)&block[6 + y*8];
+ dst[0 + y*linesize] += block[0 + y*8];
+ dst[1 + y*linesize] += block[1 + y*8];
+ dst[2 + y*linesize] += block[2 + y*8];
+ dst[3 + y*linesize] += block[3 + y*8];
+ dst[4 + y*linesize] += block[4 + y*8];
+ dst[5 + y*linesize] += block[5 + y*8];
+ dst[6 + y*linesize] += block[6 + y*8];
+ dst[7 + y*linesize] += block[7 + y*8];
}
}
const int x1 = x + offset[i + count - 1][0];
const int y1 = y + offset[i + count - 1][1];
const int index = x1 + y1*linesize;
- p->dct->get_pixels(block, p->src + sample_bytes*index, sample_bytes*linesize);
+ p->dct->get_pixels_unaligned(block, p->src + sample_bytes*index, sample_bytes*linesize);
p->dct->fdct(block);
p->requantize(block2, block, qp, p->dct->idct_permutation);
p->dct->idct(block2);
{
SPPContext *s = ctx->priv;
- if (!strcmp(cmd, "level")) {
+ if (!strcmp(cmd, "level") || !strcmp(cmd, "quality")) {
if (!strcmp(args, "max"))
s->log2_count = MAX_LEVEL;
else
SPPContext *s = ctx->priv;
int ret;
- s->avctx = avcodec_alloc_context3(NULL);
s->dct = avcodec_dct_alloc();
- if (!s->avctx || !s->dct)
+ if (!s->dct)
return AVERROR(ENOMEM);
if (opts) {
av_freep(&s->temp);
av_freep(&s->src);
- if (s->avctx) {
- avcodec_close(s->avctx);
- av_freep(&s->avctx);
- }
av_freep(&s->dct);
av_freep(&s->non_b_qp_table);
}