[FFmpeg-cvslog] avcodec/j2kenc: store libavcodec ident in a comment unless bitexact mode is used
Michael Niedermayer
git at videolan.org
Tue Jun 30 13:56:50 CEST 2015
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jun 30 13:45:03 2015 +0200| [5c047f3ad49c8a8a5ae126d134b1004a4dcbc39b] | committer: Michael Niedermayer
avcodec/j2kenc: store libavcodec ident in a comment unless bitexact mode is used
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c047f3ad49c8a8a5ae126d134b1004a4dcbc39b
---
libavcodec/j2kenc.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index dcdf411..acfa5a0 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -317,6 +317,26 @@ static int put_qcd(Jpeg2000EncoderContext *s, int compno)
return 0;
}
+static int put_com(Jpeg2000EncoderContext *s, int compno)
+{
+ int i;
+ int size = 4 + strlen(LIBAVCODEC_IDENT);
+
+ if (s->avctx->flags & CODEC_FLAG_BITEXACT)
+ return 0;
+
+ if (s->buf_end - s->buf < size + 2)
+ return -1;
+
+ bytestream_put_be16(&s->buf, JPEG2000_COM);
+ bytestream_put_be16(&s->buf, size);
+ bytestream_put_be16(&s->buf, 1); // General use (ISO/IEC 8859-15 (Latin) values)
+
+ bytestream_put_buffer(&s->buf, LIBAVCODEC_IDENT, strlen(LIBAVCODEC_IDENT));
+
+ return 0;
+}
+
static uint8_t *put_sot(Jpeg2000EncoderContext *s, int tileno)
{
uint8_t *psotptr;
@@ -1010,6 +1030,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return ret;
if ((ret = put_qcd(s, 0)) < 0)
return ret;
+ if ((ret = put_com(s, 0)) < 0)
+ return ret;
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){
uint8_t *psotptr;
More information about the ffmpeg-cvslog
mailing list