1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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.
This commit is contained in:
Peter Ross 2022-11-01 09:24:29 +11:00
parent e1dd4a27ca
commit b0c1f248d9
5 changed files with 23 additions and 9 deletions

View File

@ -41,6 +41,7 @@
#include "svq1.h" #include "svq1.h"
#include "svq1encdsp.h" #include "svq1encdsp.h"
#include "svq1enc_cb.h" #include "svq1enc_cb.h"
#include "version.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/frame.h" #include "libavutil/frame.h"
@ -572,6 +573,19 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
return 0; 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) static av_cold int svq1_encode_init(AVCodecContext *avctx)
{ {
SVQ1EncContext *const s = avctx->priv_data; 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 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, static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,

View File

@ -1,4 +1,4 @@
78cdca850b19faf3aac0b0682207451e *tests/data/fate/vsynth1-svq1.mov 89b1ec4d7bbee1ed2710c8cc8c1e269d *tests/data/fate/vsynth1-svq1.mov
1333541 tests/data/fate/vsynth1-svq1.mov 1333561 tests/data/fate/vsynth1-svq1.mov
0b9ee47ee4bf735fe3697daad64fc409 *tests/data/fate/vsynth1-svq1.out.rawvideo 0b9ee47ee4bf735fe3697daad64fc409 *tests/data/fate/vsynth1-svq1.out.rawvideo
stddev: 9.57 PSNR: 28.50 MAXDIFF: 210 bytes: 7603200/ 7603200 stddev: 9.57 PSNR: 28.50 MAXDIFF: 210 bytes: 7603200/ 7603200

View File

@ -1,4 +1,4 @@
42578021105a2f526179c5601e635312 *tests/data/fate/vsynth2-svq1.mov 14f355a06d475dcf6a90ac6ab3ae2970 *tests/data/fate/vsynth2-svq1.mov
940337 tests/data/fate/vsynth2-svq1.mov 940357 tests/data/fate/vsynth2-svq1.mov
ba8f6b721a8e19fe8a6ef92a8cff7479 *tests/data/fate/vsynth2-svq1.out.rawvideo ba8f6b721a8e19fe8a6ef92a8cff7479 *tests/data/fate/vsynth2-svq1.out.rawvideo
stddev: 3.71 PSNR: 36.72 MAXDIFF: 210 bytes: 7603200/ 7603200 stddev: 3.71 PSNR: 36.72 MAXDIFF: 210 bytes: 7603200/ 7603200

View File

@ -1,4 +1,4 @@
03805cb764c00c2162b2bed24b7f34bd *tests/data/fate/vsynth3-svq1.mov 969dcdd69774b9c42dcf81e8dd393364 *tests/data/fate/vsynth3-svq1.mov
40757 tests/data/fate/vsynth3-svq1.mov 40777 tests/data/fate/vsynth3-svq1.mov
a99efde992a2e3efcc085ecc6920a1e3 *tests/data/fate/vsynth3-svq1.out.rawvideo a99efde992a2e3efcc085ecc6920a1e3 *tests/data/fate/vsynth3-svq1.out.rawvideo
stddev: 14.49 PSNR: 24.91 MAXDIFF: 183 bytes: 86700/ 86700 stddev: 14.49 PSNR: 24.91 MAXDIFF: 183 bytes: 86700/ 86700

View File

@ -1,4 +1,4 @@
7534b2c6b7fc7201f193e9b4514cdb90 *tests/data/fate/vsynth_lena-svq1.mov 8890d9ca13934391b6891ac5f67897c6 *tests/data/fate/vsynth_lena-svq1.mov
766817 tests/data/fate/vsynth_lena-svq1.mov 766837 tests/data/fate/vsynth_lena-svq1.mov
85261558fa744ef468fe77dbe4d91d8d *tests/data/fate/vsynth_lena-svq1.out.rawvideo 85261558fa744ef468fe77dbe4d91d8d *tests/data/fate/vsynth_lena-svq1.out.rawvideo
stddev: 3.23 PSNR: 37.93 MAXDIFF: 61 bytes: 7603200/ 7603200 stddev: 3.23 PSNR: 37.93 MAXDIFF: 61 bytes: 7603200/ 7603200