You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
Merge remote-tracking branch 'qatar/master'
* qatar/master: nuv: K&R formatting cosmetics build: generalise rules and variable settings for av* programs nuv: check RTjpeg header for validity Revert "nuv: check per-frame header for validity." imc: remove unused field IMCContext.one_div_log2 imc: fix size of a memset() imc: remove empty if() block fate: simplify variable setting filter.mak lavf: Declare an AVRational struct without a struct literal Conflicts: Makefile configure libavcodec/nuv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
17
Makefile
17
Makefile
@@ -17,7 +17,7 @@ PROGS-$(CONFIG_FFSERVER) += ffserver
|
|||||||
|
|
||||||
PROGS := $(PROGS-yes:%=%$(EXESUF))
|
PROGS := $(PROGS-yes:%=%$(EXESUF))
|
||||||
INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
|
INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
|
||||||
OBJS = $(PROGS-yes:%=%.o) cmdutils.o
|
OBJS = cmdutils.o
|
||||||
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
|
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
|
||||||
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
||||||
TOOLS = qt-faststart trasher
|
TOOLS = qt-faststart trasher
|
||||||
@@ -88,12 +88,19 @@ endef
|
|||||||
|
|
||||||
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
||||||
|
|
||||||
ffplay.o: CFLAGS += $(SDL_CFLAGS)
|
define DOPROG
|
||||||
ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
|
OBJS-$(1) += $(1).o
|
||||||
ffserver_g$(EXESUF): LDFLAGS += $(FFSERVERLDFLAGS)
|
$(1)_g$(EXESUF): $(OBJS-$(1))
|
||||||
|
$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
|
||||||
|
$(1)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
|
||||||
|
$(1)_g$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
|
||||||
|
-include $$(OBJS-$(1):.o=.d)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
|
||||||
|
|
||||||
%$(PROGSSUF)_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
|
%$(PROGSSUF)_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
|
||||||
$(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
|
$(LD) $(LDFLAGS) -o $@ $(OBJS-$*) cmdutils.o $(FF_EXTRALIBS)
|
||||||
|
|
||||||
OBJDIRS += tools
|
OBJDIRS += tools
|
||||||
|
|
||||||
|
6
configure
vendored
6
configure
vendored
@@ -3926,7 +3926,7 @@ CXX_O=$CXX_O
|
|||||||
LD_O=$LD_O
|
LD_O=$LD_O
|
||||||
DLLTOOL=$dlltool
|
DLLTOOL=$dlltool
|
||||||
LDFLAGS=$LDFLAGS
|
LDFLAGS=$LDFLAGS
|
||||||
FFSERVERLDFLAGS=$FFSERVERLDFLAGS
|
LDFLAGS-ffserver=$FFSERVERLDFLAGS
|
||||||
SHFLAGS=$SHFLAGS
|
SHFLAGS=$SHFLAGS
|
||||||
YASMFLAGS=$YASMFLAGS
|
YASMFLAGS=$YASMFLAGS
|
||||||
BUILDSUF=$build_suffix
|
BUILDSUF=$build_suffix
|
||||||
@@ -3960,8 +3960,8 @@ HOSTCC_C=$HOSTCC_C
|
|||||||
HOSTCC_O=$HOSTCC_O
|
HOSTCC_O=$HOSTCC_O
|
||||||
TARGET_EXEC=$target_exec
|
TARGET_EXEC=$target_exec
|
||||||
TARGET_PATH=$target_path
|
TARGET_PATH=$target_path
|
||||||
SDL_LIBS=$sdl_libs
|
LIBS-ffplay=$sdl_libs
|
||||||
SDL_CFLAGS=$sdl_cflags
|
CFLAGS-ffplay=$sdl_cflags
|
||||||
LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
|
LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
|
||||||
EXTRALIBS=$extralibs
|
EXTRALIBS=$extralibs
|
||||||
INSTALL=$install
|
INSTALL=$install
|
||||||
|
@@ -92,7 +92,6 @@ typedef struct {
|
|||||||
|
|
||||||
float sqrt_tab[30];
|
float sqrt_tab[30];
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
float one_div_log2;
|
|
||||||
|
|
||||||
DSPContext dsp;
|
DSPContext dsp;
|
||||||
FFTContext fft;
|
FFTContext fft;
|
||||||
@@ -227,10 +226,6 @@ static av_cold int imc_decode_init(AVCodecContext *avctx)
|
|||||||
imc_huffman_bits[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
imc_huffman_bits[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
q->one_div_log2 = 1 / log(2);
|
|
||||||
|
|
||||||
if (avctx->codec_id == CODEC_ID_IAC) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (avctx->codec_id == CODEC_ID_IAC) {
|
if (avctx->codec_id == CODEC_ID_IAC) {
|
||||||
iac_generate_tabs(q, avctx->sample_rate);
|
iac_generate_tabs(q, avctx->sample_rate);
|
||||||
@@ -792,7 +787,7 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
|
|||||||
chctx->decoder_reset = 1;
|
chctx->decoder_reset = 1;
|
||||||
|
|
||||||
if (chctx->decoder_reset) {
|
if (chctx->decoder_reset) {
|
||||||
memset(q->out_samples, 0, sizeof(q->out_samples));
|
memset(q->out_samples, 0, COEFFS * sizeof(*q->out_samples));
|
||||||
for (i = 0; i < BANDS; i++)
|
for (i = 0; i < BANDS; i++)
|
||||||
chctx->old_floor[i] = 1.0;
|
chctx->old_floor[i] = 1.0;
|
||||||
for (i = 0; i < COEFFS; i++)
|
for (i = 0; i < COEFFS; i++)
|
||||||
|
173
libavcodec/nuv.c
173
libavcodec/nuv.c
@@ -18,6 +18,7 @@
|
|||||||
* License along with FFmpeg; if not, write to the Free Software
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@@ -35,7 +36,7 @@ typedef struct {
|
|||||||
int quality;
|
int quality;
|
||||||
int width, height;
|
int width, height;
|
||||||
unsigned int decomp_size;
|
unsigned int decomp_size;
|
||||||
unsigned char* decomp_buf;
|
unsigned char *decomp_buf;
|
||||||
uint32_t lq[64], cq[64];
|
uint32_t lq[64], cq[64];
|
||||||
RTJpegContext rtj;
|
RTJpegContext rtj;
|
||||||
DSPContext dsp;
|
DSPContext dsp;
|
||||||
@@ -70,8 +71,8 @@ static const uint8_t fallback_cquant[] = {
|
|||||||
* @param width width of the video frame
|
* @param width width of the video frame
|
||||||
* @param height height of the video frame
|
* @param height height of the video frame
|
||||||
*/
|
*/
|
||||||
static void copy_frame(AVFrame *f, const uint8_t *src,
|
static void copy_frame(AVFrame *f, const uint8_t *src, int width, int height)
|
||||||
int width, int height) {
|
{
|
||||||
AVPicture pic;
|
AVPicture pic;
|
||||||
avpicture_fill(&pic, src, PIX_FMT_YUV420P, width, height);
|
avpicture_fill(&pic, src, PIX_FMT_YUV420P, width, height);
|
||||||
av_picture_copy((AVPicture *)f, &pic, PIX_FMT_YUV420P, width, height);
|
av_picture_copy((AVPicture *)f, &pic, PIX_FMT_YUV420P, width, height);
|
||||||
@@ -80,8 +81,9 @@ static void copy_frame(AVFrame *f, const uint8_t *src,
|
|||||||
/**
|
/**
|
||||||
* @brief extract quantization tables from codec data into our context
|
* @brief extract quantization tables from codec data into our context
|
||||||
*/
|
*/
|
||||||
static int get_quant(AVCodecContext *avctx, NuvContext *c,
|
static int get_quant(AVCodecContext *avctx, NuvContext *c, const uint8_t *buf,
|
||||||
const uint8_t *buf, int size) {
|
int size)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
if (size < 2 * 64 * 4) {
|
if (size < 2 * 64 * 4) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "insufficient rtjpeg quant data\n");
|
av_log(avctx, AV_LOG_ERROR, "insufficient rtjpeg quant data\n");
|
||||||
@@ -97,7 +99,8 @@ static int get_quant(AVCodecContext *avctx, NuvContext *c,
|
|||||||
/**
|
/**
|
||||||
* @brief set quantization tables from a quality value
|
* @brief set quantization tables from a quality value
|
||||||
*/
|
*/
|
||||||
static void get_quant_quality(NuvContext *c, int quality) {
|
static void get_quant_quality(NuvContext *c, int quality)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
quality = FFMAX(quality, 1);
|
quality = FFMAX(quality, 1);
|
||||||
for (i = 0; i < 64; i++) {
|
for (i = 0; i < 64; i++) {
|
||||||
@@ -106,7 +109,9 @@ static void get_quant_quality(NuvContext *c, int quality) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int codec_reinit(AVCodecContext *avctx, int width, int height, int quality) {
|
static int codec_reinit(AVCodecContext *avctx, int width, int height,
|
||||||
|
int quality)
|
||||||
|
{
|
||||||
NuvContext *c = avctx->priv_data;
|
NuvContext *c = avctx->priv_data;
|
||||||
width = FFALIGN(width, 2);
|
width = FFALIGN(width, 2);
|
||||||
height = FFALIGN(height, 2);
|
height = FFALIGN(height, 2);
|
||||||
@@ -118,33 +123,44 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit
|
|||||||
if (av_image_check_size(height, width, 0, avctx) < 0 ||
|
if (av_image_check_size(height, width, 0, avctx) < 0 ||
|
||||||
buf_size > INT_MAX/8)
|
buf_size > INT_MAX/8)
|
||||||
return -1;
|
return -1;
|
||||||
avctx->width = c->width = width;
|
avctx->width = c->width = width;
|
||||||
avctx->height = c->height = height;
|
avctx->height = c->height = height;
|
||||||
av_fast_malloc(&c->decomp_buf, &c->decomp_size, buf_size);
|
av_fast_malloc(&c->decomp_buf, &c->decomp_size,
|
||||||
|
buf_size);
|
||||||
if (!c->decomp_buf) {
|
if (!c->decomp_buf) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
|
"Can't allocate decompression buffer.\n");
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
|
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height,
|
||||||
|
c->lq, c->cq);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (quality != c->quality)
|
} else if (quality != c->quality)
|
||||||
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
|
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height,
|
||||||
|
c->lq, c->cq);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||||
AVPacket *avpkt) {
|
AVPacket *avpkt)
|
||||||
|
{
|
||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
NuvContext *c = avctx->priv_data;
|
NuvContext *c = avctx->priv_data;
|
||||||
AVFrame *picture = data;
|
AVFrame *picture = data;
|
||||||
int orig_size = buf_size;
|
int orig_size = buf_size;
|
||||||
int keyframe;
|
int keyframe;
|
||||||
int size_change = 0;
|
int size_change = 0;
|
||||||
int result;
|
int result;
|
||||||
enum {NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1',
|
enum {
|
||||||
NUV_RTJPEG_IN_LZO = '2', NUV_LZO = '3',
|
NUV_UNCOMPRESSED = '0',
|
||||||
NUV_BLACK = 'N', NUV_COPY_LAST = 'L'} comptype;
|
NUV_RTJPEG = '1',
|
||||||
|
NUV_RTJPEG_IN_LZO = '2',
|
||||||
|
NUV_LZO = '3',
|
||||||
|
NUV_BLACK = 'N',
|
||||||
|
NUV_COPY_LAST = 'L'
|
||||||
|
} comptype;
|
||||||
|
|
||||||
if (buf_size < 12) {
|
if (buf_size < 12) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
|
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
|
||||||
@@ -155,12 +171,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
|||||||
if (buf[0] == 'D' && buf[1] == 'R') {
|
if (buf[0] == 'D' && buf[1] == 'R') {
|
||||||
int ret;
|
int ret;
|
||||||
// skip rest of the frameheader.
|
// skip rest of the frameheader.
|
||||||
buf = &buf[12];
|
buf = &buf[12];
|
||||||
buf_size -= 12;
|
buf_size -= 12;
|
||||||
ret = get_quant(avctx, c, buf, buf_size);
|
ret = get_quant(avctx, c, buf, buf_size);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
|
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq,
|
||||||
|
c->cq);
|
||||||
return orig_size;
|
return orig_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,28 +187,32 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
|||||||
}
|
}
|
||||||
comptype = buf[1];
|
comptype = buf[1];
|
||||||
switch (comptype) {
|
switch (comptype) {
|
||||||
case NUV_RTJPEG_IN_LZO:
|
case NUV_RTJPEG_IN_LZO:
|
||||||
case NUV_RTJPEG:
|
case NUV_RTJPEG:
|
||||||
keyframe = !buf[2]; break;
|
keyframe = !buf[2];
|
||||||
case NUV_COPY_LAST:
|
break;
|
||||||
keyframe = 0; break;
|
case NUV_COPY_LAST:
|
||||||
default:
|
keyframe = 0;
|
||||||
keyframe = 1; break;
|
break;
|
||||||
|
default:
|
||||||
|
keyframe = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
retry:
|
retry:
|
||||||
// skip rest of the frameheader.
|
// skip rest of the frameheader.
|
||||||
buf = &buf[12];
|
buf = &buf[12];
|
||||||
buf_size -= 12;
|
buf_size -= 12;
|
||||||
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
|
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
|
||||||
int outlen = c->decomp_size - AV_LZO_OUTPUT_PADDING, inlen = buf_size;
|
int outlen = c->decomp_size - AV_LZO_OUTPUT_PADDING, inlen = buf_size;
|
||||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
|
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
|
||||||
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
||||||
buf = c->decomp_buf;
|
buf = c->decomp_buf;
|
||||||
buf_size = c->decomp_size - AV_LZO_OUTPUT_PADDING - outlen;
|
buf_size = c->decomp_size - AV_LZO_OUTPUT_PADDING - outlen;
|
||||||
}
|
}
|
||||||
if (c->codec_frameheader) {
|
if (c->codec_frameheader) {
|
||||||
int w, h, q, res;
|
int w, h, q;
|
||||||
if (buf_size < 12) {
|
int res;
|
||||||
|
if (buf_size < RTJPEG_HEADER_SIZE) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Too small NUV video frame\n");
|
av_log(avctx, AV_LOG_ERROR, "Too small NUV video frame\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
@@ -214,14 +235,14 @@ retry:
|
|||||||
size_change = 1;
|
size_change = 1;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
buf = &buf[12];
|
buf = &buf[RTJPEG_HEADER_SIZE];
|
||||||
buf_size -= 12;
|
buf_size -= RTJPEG_HEADER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_change || keyframe) && c->pic.data[0])
|
if ((size_change || keyframe) && c->pic.data[0])
|
||||||
avctx->release_buffer(avctx, &c->pic);
|
avctx->release_buffer(avctx, &c->pic);
|
||||||
c->pic.reference = 3;
|
c->pic.reference = 3;
|
||||||
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
|
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
|
||||||
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
|
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
|
||||||
result = avctx->reget_buffer(avctx, &c->pic);
|
result = avctx->reget_buffer(avctx, &c->pic);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
@@ -233,63 +254,69 @@ retry:
|
|||||||
c->pic.key_frame = keyframe;
|
c->pic.key_frame = keyframe;
|
||||||
// decompress/copy/whatever data
|
// decompress/copy/whatever data
|
||||||
switch (comptype) {
|
switch (comptype) {
|
||||||
case NUV_LZO:
|
case NUV_LZO:
|
||||||
case NUV_UNCOMPRESSED: {
|
case NUV_UNCOMPRESSED: {
|
||||||
int height = c->height;
|
int height = c->height;
|
||||||
if (buf_size < c->width * height * 3 / 2) {
|
if (buf_size < c->width * height * 3 / 2) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "uncompressed frame too short\n");
|
av_log(avctx, AV_LOG_ERROR, "uncompressed frame too short\n");
|
||||||
height = buf_size / c->width / 3 * 2;
|
height = buf_size / c->width / 3 * 2;
|
||||||
}
|
|
||||||
copy_frame(&c->pic, buf, c->width, height);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case NUV_RTJPEG_IN_LZO:
|
copy_frame(&c->pic, buf, c->width, height);
|
||||||
case NUV_RTJPEG: {
|
break;
|
||||||
ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
|
}
|
||||||
break;
|
case NUV_RTJPEG_IN_LZO:
|
||||||
}
|
case NUV_RTJPEG:
|
||||||
case NUV_BLACK: {
|
ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
|
||||||
memset(c->pic.data[0], 0, c->width * c->height);
|
break;
|
||||||
memset(c->pic.data[1], 128, c->width * c->height / 4);
|
case NUV_BLACK:
|
||||||
memset(c->pic.data[2], 128, c->width * c->height / 4);
|
memset(c->pic.data[0], 0, c->width * c->height);
|
||||||
break;
|
memset(c->pic.data[1], 128, c->width * c->height / 4);
|
||||||
}
|
memset(c->pic.data[2], 128, c->width * c->height / 4);
|
||||||
case NUV_COPY_LAST: {
|
break;
|
||||||
/* nothing more to do here */
|
case NUV_COPY_LAST:
|
||||||
break;
|
/* nothing more to do here */
|
||||||
}
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
|
av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*picture = c->pic;
|
*picture = c->pic;
|
||||||
*data_size = sizeof(AVFrame);
|
*data_size = sizeof(AVFrame);
|
||||||
return orig_size;
|
return orig_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int decode_init(AVCodecContext *avctx) {
|
static av_cold int decode_init(AVCodecContext *avctx)
|
||||||
NuvContext *c = avctx->priv_data;
|
{
|
||||||
|
NuvContext *c = avctx->priv_data;
|
||||||
avctx->pix_fmt = PIX_FMT_YUV420P;
|
avctx->pix_fmt = PIX_FMT_YUV420P;
|
||||||
c->pic.data[0] = NULL;
|
c->pic.data[0] = NULL;
|
||||||
c->decomp_buf = NULL;
|
c->decomp_buf = NULL;
|
||||||
c->quality = -1;
|
c->quality = -1;
|
||||||
c->width = 0;
|
c->width = 0;
|
||||||
c->height = 0;
|
c->height = 0;
|
||||||
|
|
||||||
c->codec_frameheader = avctx->codec_tag == MKTAG('R', 'J', 'P', 'G');
|
c->codec_frameheader = avctx->codec_tag == MKTAG('R', 'J', 'P', 'G');
|
||||||
|
|
||||||
if (avctx->extradata_size)
|
if (avctx->extradata_size)
|
||||||
get_quant(avctx, c, avctx->extradata, avctx->extradata_size);
|
get_quant(avctx, c, avctx->extradata, avctx->extradata_size);
|
||||||
|
|
||||||
ff_dsputil_init(&c->dsp, avctx);
|
ff_dsputil_init(&c->dsp, avctx);
|
||||||
|
|
||||||
if (codec_reinit(avctx, avctx->width, avctx->height, -1) < 0)
|
if (codec_reinit(avctx, avctx->width, avctx->height, -1) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int decode_end(AVCodecContext *avctx) {
|
static av_cold int decode_end(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
NuvContext *c = avctx->priv_data;
|
NuvContext *c = avctx->priv_data;
|
||||||
|
|
||||||
av_freep(&c->decomp_buf);
|
av_freep(&c->decomp_buf);
|
||||||
if (c->pic.data[0])
|
if (c->pic.data[0])
|
||||||
avctx->release_buffer(avctx, &c->pic);
|
avctx->release_buffer(avctx, &c->pic);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
|
|
||||||
|
#define RTJPEG_FILE_VERSION 0
|
||||||
|
#define RTJPEG_HEADER_SIZE 12
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int w, h;
|
int w, h;
|
||||||
DSPContext *dsp;
|
DSPContext *dsp;
|
||||||
|
@@ -2798,7 +2798,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
|||||||
/* round guessed framerate to a "standard" framerate if it's
|
/* round guessed framerate to a "standard" framerate if it's
|
||||||
* within 1% of the original estimate*/
|
* within 1% of the original estimate*/
|
||||||
for (j = 1; j < MAX_STD_TIMEBASES; j++) {
|
for (j = 1; j < MAX_STD_TIMEBASES; j++) {
|
||||||
AVRational std_fps = (AVRational){get_std_framerate(j), 12*1001};
|
AVRational std_fps = { get_std_framerate(j), 12*1001 };
|
||||||
double error = fabs(av_q2d(st->avg_frame_rate) / av_q2d(std_fps) - 1);
|
double error = fabs(av_q2d(st->avg_frame_rate) / av_q2d(std_fps) - 1);
|
||||||
|
|
||||||
if (error < best_error) {
|
if (error < best_error) {
|
||||||
|
@@ -19,21 +19,16 @@ $(FATE_AMIX): CMP = oneoff
|
|||||||
$(FATE_AMIX): CMP_UNIT = f32
|
$(FATE_AMIX): CMP_UNIT = f32
|
||||||
|
|
||||||
FATE_FILTER += $(FATE_AMIX)
|
FATE_FILTER += $(FATE_AMIX)
|
||||||
FATE_SAMPLES_AVCONV += $(FATE_AMIX)
|
|
||||||
|
|
||||||
FATE_ASYNCTS += fate-filter-asyncts
|
FATE_FILTER += fate-filter-asyncts
|
||||||
fate-filter-asyncts: SRC = $(SAMPLES)/nellymoser/nellymoser-discont.flv
|
fate-filter-asyncts: SRC = $(SAMPLES)/nellymoser/nellymoser-discont.flv
|
||||||
fate-filter-asyncts: CMD = pcm -i $(SRC) -af aresample=min_comp=0.001:min_hard_comp=0.1
|
fate-filter-asyncts: CMD = pcm -i $(SRC) -af aresample=min_comp=0.001:min_hard_comp=0.1
|
||||||
fate-filter-asyncts: CMP = oneoff
|
fate-filter-asyncts: CMP = oneoff
|
||||||
fate-filter-asyncts: REF = $(SAMPLES)/nellymoser/nellymoser-discont.pcm
|
fate-filter-asyncts: REF = $(SAMPLES)/nellymoser/nellymoser-discont.pcm
|
||||||
|
|
||||||
FATE_FILTER += $(FATE_ASYNCTS)
|
|
||||||
FATE_SAMPLES_AVCONV += $(FATE_ASYNCTS)
|
|
||||||
|
|
||||||
fate-filter-delogo: CMD = framecrc -i $(SAMPLES)/real/rv30.rm -vf delogo=show=0:x=290:y=25:w=26:h=16 -an
|
fate-filter-delogo: CMD = framecrc -i $(SAMPLES)/real/rv30.rm -vf delogo=show=0:x=290:y=25:w=26:h=16 -an
|
||||||
|
|
||||||
FATE_FILTER += fate-filter-delogo
|
FATE_FILTER += fate-filter-delogo
|
||||||
FATE_SAMPLES_AVCONV += fate-filter-delogo
|
|
||||||
|
|
||||||
FATE_YADIF += fate-filter-yadif-mode0
|
FATE_YADIF += fate-filter-yadif-mode0
|
||||||
fate-filter-yadif-mode0: CMD = framecrc -flags bitexact -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=0
|
fate-filter-yadif-mode0: CMD = framecrc -flags bitexact -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=0
|
||||||
@@ -42,6 +37,6 @@ FATE_YADIF += fate-filter-yadif-mode1
|
|||||||
fate-filter-yadif-mode1: CMD = framecrc -flags bitexact -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=1
|
fate-filter-yadif-mode1: CMD = framecrc -flags bitexact -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=1
|
||||||
|
|
||||||
FATE_FILTER += $(FATE_YADIF)
|
FATE_FILTER += $(FATE_YADIF)
|
||||||
FATE_SAMPLES_AVCONV += $(FATE_YADIF)
|
|
||||||
|
|
||||||
|
FATE_SAMPLES_AVCONV += $(FATE_FILTER)
|
||||||
fate-filter: $(FATE_FILTER)
|
fate-filter: $(FATE_FILTER)
|
||||||
|
Reference in New Issue
Block a user