Commit b0c1f248 authored by Peter Ross's avatar Peter Ross

avcodec/svq1enc: output ident string in extradata field

This will enable the acurate identification of FFmpeg produced
SVQ1 streams, should there be new bugs found in the encoder.
parent e1dd4a27
......@@ -41,6 +41,7 @@
#include "svq1.h"
#include "svq1encdsp.h"
#include "svq1enc_cb.h"
#include "version.h"
#include "libavutil/avassert.h"
#include "libavutil/frame.h"
......@@ -572,6 +573,19 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
return 0;
}
static av_cold int write_ident(AVCodecContext *avctx, const char *ident)
{
int size = strlen(ident);
avctx->extradata = av_malloc(size + 8);
if (!avctx->extradata)
return AVERROR(ENOMEM);
AV_WB32(avctx->extradata, size + 8);
AV_WL32(avctx->extradata + 4, MKTAG('S', 'V', 'Q', '1'));
memcpy(avctx->extradata + 8, ident, size);
avctx->extradata_size = size + 8;
return 0;
}
static av_cold int svq1_encode_init(AVCodecContext *avctx)
{
SVQ1EncContext *const s = avctx->priv_data;
......@@ -632,7 +646,7 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
ff_h263_encode_init(&s->m); // mv_penalty
return 0;
return write_ident(avctx, s->avctx->flags & AV_CODEC_FLAG_BITEXACT ? "Lavc" : LIBAVCODEC_IDENT);
}
static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
......
78cdca850b19faf3aac0b0682207451e *tests/data/fate/vsynth1-svq1.mov
1333541 tests/data/fate/vsynth1-svq1.mov
89b1ec4d7bbee1ed2710c8cc8c1e269d *tests/data/fate/vsynth1-svq1.mov
1333561 tests/data/fate/vsynth1-svq1.mov
0b9ee47ee4bf735fe3697daad64fc409 *tests/data/fate/vsynth1-svq1.out.rawvideo
stddev: 9.57 PSNR: 28.50 MAXDIFF: 210 bytes: 7603200/ 7603200
42578021105a2f526179c5601e635312 *tests/data/fate/vsynth2-svq1.mov
940337 tests/data/fate/vsynth2-svq1.mov
14f355a06d475dcf6a90ac6ab3ae2970 *tests/data/fate/vsynth2-svq1.mov
940357 tests/data/fate/vsynth2-svq1.mov
ba8f6b721a8e19fe8a6ef92a8cff7479 *tests/data/fate/vsynth2-svq1.out.rawvideo
stddev: 3.71 PSNR: 36.72 MAXDIFF: 210 bytes: 7603200/ 7603200
03805cb764c00c2162b2bed24b7f34bd *tests/data/fate/vsynth3-svq1.mov
40757 tests/data/fate/vsynth3-svq1.mov
969dcdd69774b9c42dcf81e8dd393364 *tests/data/fate/vsynth3-svq1.mov
40777 tests/data/fate/vsynth3-svq1.mov
a99efde992a2e3efcc085ecc6920a1e3 *tests/data/fate/vsynth3-svq1.out.rawvideo
stddev: 14.49 PSNR: 24.91 MAXDIFF: 183 bytes: 86700/ 86700
7534b2c6b7fc7201f193e9b4514cdb90 *tests/data/fate/vsynth_lena-svq1.mov
766817 tests/data/fate/vsynth_lena-svq1.mov
8890d9ca13934391b6891ac5f67897c6 *tests/data/fate/vsynth_lena-svq1.mov
766837 tests/data/fate/vsynth_lena-svq1.mov
85261558fa744ef468fe77dbe4d91d8d *tests/data/fate/vsynth_lena-svq1.out.rawvideo
stddev: 3.23 PSNR: 37.93 MAXDIFF: 61 bytes: 7603200/ 7603200
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment