mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavfi/vf_spp: convert to the video_enc_params API
Re-enable fate-filter-spp
This commit is contained in:
parent
a11ee84194
commit
775707aba9
@ -414,7 +414,7 @@ OBJS-$(CONFIG_SOBEL_FILTER) += vf_convolution.o
|
|||||||
OBJS-$(CONFIG_SOBEL_OPENCL_FILTER) += vf_convolution_opencl.o opencl.o \
|
OBJS-$(CONFIG_SOBEL_OPENCL_FILTER) += vf_convolution_opencl.o opencl.o \
|
||||||
opencl/convolution.o
|
opencl/convolution.o
|
||||||
OBJS-$(CONFIG_SPLIT_FILTER) += split.o
|
OBJS-$(CONFIG_SPLIT_FILTER) += split.o
|
||||||
OBJS-$(CONFIG_SPP_FILTER) += vf_spp.o
|
OBJS-$(CONFIG_SPP_FILTER) += vf_spp.o qp_table.o
|
||||||
OBJS-$(CONFIG_SR_FILTER) += vf_sr.o
|
OBJS-$(CONFIG_SR_FILTER) += vf_sr.o
|
||||||
OBJS-$(CONFIG_SSIM_FILTER) += vf_ssim.o framesync.o
|
OBJS-$(CONFIG_SSIM_FILTER) += vf_ssim.o framesync.o
|
||||||
OBJS-$(CONFIG_STEREO3D_FILTER) += vf_stereo3d.o
|
OBJS-$(CONFIG_STEREO3D_FILTER) += vf_stereo3d.o
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "qp_table.h"
|
||||||
#include "vf_spp.h"
|
#include "vf_spp.h"
|
||||||
|
|
||||||
enum mode {
|
enum mode {
|
||||||
@ -375,47 +376,34 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
AVFilterLink *outlink = ctx->outputs[0];
|
AVFilterLink *outlink = ctx->outputs[0];
|
||||||
AVFrame *out = in;
|
AVFrame *out = in;
|
||||||
int qp_stride = 0;
|
int qp_stride = 0;
|
||||||
const int8_t *qp_table = NULL;
|
int8_t *qp_table = NULL;
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
||||||
const int depth = desc->comp[0].depth;
|
const int depth = desc->comp[0].depth;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
/* if we are not in a constant user quantizer mode and we don't want to use
|
/* if we are not in a constant user quantizer mode and we don't want to use
|
||||||
* the quantizers from the B-frames (B-frames often have a higher QP), we
|
* the quantizers from the B-frames (B-frames often have a higher QP), we
|
||||||
* need to save the qp table from the last non B-frame; this is what the
|
* need to save the qp table from the last non B-frame; this is what the
|
||||||
* following code block does */
|
* following code block does */
|
||||||
if (!s->qp) {
|
if (!s->qp && (s->use_bframe_qp || in->pict_type != AV_PICTURE_TYPE_B)) {
|
||||||
qp_table = av_frame_get_qp_table(in, &qp_stride, &s->qscale_type);
|
ret = ff_qp_table_extract(in, &qp_table, &qp_stride, NULL, &s->qscale_type);
|
||||||
|
if (ret < 0) {
|
||||||
|
av_frame_free(&in);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (qp_table && !s->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) {
|
if (!s->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) {
|
||||||
int w, h;
|
av_freep(&s->non_b_qp_table);
|
||||||
|
s->non_b_qp_table = qp_table;
|
||||||
/* if the qp stride is not set, it means the QP are only defined on
|
s->non_b_qp_stride = qp_stride;
|
||||||
* a line basis */
|
|
||||||
if (!qp_stride) {
|
|
||||||
w = AV_CEIL_RSHIFT(inlink->w, 4);
|
|
||||||
h = 1;
|
|
||||||
} else {
|
|
||||||
w = qp_stride;
|
|
||||||
h = AV_CEIL_RSHIFT(inlink->h, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (w * h > s->non_b_qp_alloc_size) {
|
|
||||||
int ret = av_reallocp_array(&s->non_b_qp_table, w, h);
|
|
||||||
if (ret < 0) {
|
|
||||||
s->non_b_qp_alloc_size = 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
s->non_b_qp_alloc_size = w * h;
|
|
||||||
}
|
|
||||||
|
|
||||||
av_assert0(w * h <= s->non_b_qp_alloc_size);
|
|
||||||
memcpy(s->non_b_qp_table, qp_table, w * h);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->log2_count && !ctx->is_disabled) {
|
if (s->log2_count && !ctx->is_disabled) {
|
||||||
if (!s->use_bframe_qp && s->non_b_qp_table)
|
if (!s->use_bframe_qp && s->non_b_qp_table) {
|
||||||
qp_table = s->non_b_qp_table;
|
qp_table = s->non_b_qp_table;
|
||||||
|
qp_stride = s->non_b_qp_stride;
|
||||||
|
}
|
||||||
|
|
||||||
if (qp_table || s->qp) {
|
if (qp_table || s->qp) {
|
||||||
const int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub);
|
const int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub);
|
||||||
@ -430,7 +418,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
out = ff_get_video_buffer(outlink, aligned_w, aligned_h);
|
out = ff_get_video_buffer(outlink, aligned_w, aligned_h);
|
||||||
if (!out) {
|
if (!out) {
|
||||||
av_frame_free(&in);
|
av_frame_free(&in);
|
||||||
return AVERROR(ENOMEM);
|
ret = AVERROR(ENOMEM);
|
||||||
|
goto finish;
|
||||||
}
|
}
|
||||||
av_frame_copy_props(out, in);
|
av_frame_copy_props(out, in);
|
||||||
out->width = in->width;
|
out->width = in->width;
|
||||||
@ -454,7 +443,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
inlink->w, inlink->h);
|
inlink->w, inlink->h);
|
||||||
av_frame_free(&in);
|
av_frame_free(&in);
|
||||||
}
|
}
|
||||||
return ff_filter_frame(outlink, out);
|
ret = ff_filter_frame(outlink, out);
|
||||||
|
finish:
|
||||||
|
if (qp_table != s->non_b_qp_table)
|
||||||
|
av_freep(&qp_table);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
|
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
|
||||||
|
@ -39,7 +39,7 @@ typedef struct SPPContext {
|
|||||||
uint16_t *temp;
|
uint16_t *temp;
|
||||||
AVDCT *dct;
|
AVDCT *dct;
|
||||||
int8_t *non_b_qp_table;
|
int8_t *non_b_qp_table;
|
||||||
int non_b_qp_alloc_size;
|
int non_b_qp_stride;
|
||||||
int use_bframe_qp;
|
int use_bframe_qp;
|
||||||
int hsub, vsub;
|
int hsub, vsub;
|
||||||
|
|
||||||
|
@ -577,9 +577,9 @@ fate-filter-pp6: CMD = video_filter "pp=be/fd"
|
|||||||
fate-filter-pp7: fate-vsynth1-mpeg4-qprd
|
fate-filter-pp7: fate-vsynth1-mpeg4-qprd
|
||||||
fate-filter-pp7: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp7"
|
fate-filter-pp7: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp7"
|
||||||
|
|
||||||
#FATE_FILTER_VSYNTH-$(CONFIG_SPP_FILTER) += fate-filter-spp
|
FATE_FILTER_VSYNTH-$(CONFIG_SPP_FILTER) += fate-filter-spp
|
||||||
fate-filter-spp: fate-vsynth1-mpeg4-qprd
|
fate-filter-spp: fate-vsynth1-mpeg4-qprd
|
||||||
fate-filter-spp: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "spp=idct=simple:dct=int"
|
fate-filter-spp: CMD = framecrc -flags bitexact -export_side_data venc_params -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "spp=idct=simple:dct=int"
|
||||||
|
|
||||||
FATE_FILTER_VSYNTH-$(CONFIG_CODECVIEW_FILTER) += fate-filter-codecview
|
FATE_FILTER_VSYNTH-$(CONFIG_CODECVIEW_FILTER) += fate-filter-codecview
|
||||||
fate-filter-codecview: fate-vsynth1-mpeg4-qprd
|
fate-filter-codecview: fate-vsynth1-mpeg4-qprd
|
||||||
|
Loading…
Reference in New Issue
Block a user