[FFmpeg-cvslog] avutil/pixdesc: Remove always-false checks

2022-09-30 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Sep 26 19:37:25 2022 +0200| [6d0a7e96e746a8a0fc03725a0f5e2c908c82b7c3] | 
committer: Andreas Rheinhardt

avutil/pixdesc: Remove always-false checks

ff_check_pixfmt_descriptors() was added in commit
20e99a9c10cdbe9ad659dce5bdec569d744f8219. At this time,
the values of enum AVPixelFormat were not contiguous;
instead there was a jump from 111 to 291 (or from 115
to 295 depending upon AV_PIX_FMT_ABI_GIT_MASTER).
ff_check_pixfmt_descriptors() accounts for this
by skipping empty descriptors. Yet this issue no longer
exists: There are no holes.

The check for said holes makes GCC believe that the name
can be NULL; because it is used as argument corresponding to
%s in a log statement, it therefore emits a warning
(since d75c4693fef51e8f0a1b88798530f4c5147ea906). Therefore
this commit simply removes these checks.

Also move the checks for name before the log statement.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d0a7e96e746a8a0fc03725a0f5e2c908c82b7c3
---

 libavutil/pixdesc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 3ac44614a7..c42a0242c5 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2922,13 +2922,11 @@ void ff_check_pixfmt_descriptors(void){
 int linesize[4] = {0,0,0,0};
 uint16_t tmp[2];
 
-if (!d->name && !d->nb_components && !d->log2_chroma_w && 
!d->log2_chroma_h && !d->flags)
-continue;
+av_assert0(d->name && d->name[0]);
 av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name);
 av_assert0(d->log2_chroma_w <= 3);
 av_assert0(d->log2_chroma_h <= 3);
 av_assert0(d->nb_components <= 4);
-av_assert0(d->name && d->name[0]);
 av_assert2(av_get_pix_fmt(d->name) == i);
 
 for (j=0; jcomp); j++) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/pixdesc: Avoid direct access to pix fmt desc array

2022-09-30 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Sep 26 20:21:51 2022 +0200| [571b670e7dfc90394ba1f3cf736f446976c832da] | 
committer: Andreas Rheinhardt

avutil/pixdesc: Avoid direct access to pix fmt desc array

Instead use av_pix_fmt_desc_next(). It is still possible
to check its return values by comparing it with the
(currently) expected values and the code does so.

Reviewed-by: Anton Khirnov 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=571b670e7dfc90394ba1f3cf736f446976c832da
---

 libavutil/pixdesc.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index c42a0242c5..4f95f88aba 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2913,10 +2913,10 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
 }
 
 void ff_check_pixfmt_descriptors(void){
-int i, j;
+const AVPixFmtDescriptor *d, *last = NULL;
+int i;
 
-for (i=0; ilog2_chroma_w <= 3);
 av_assert0(d->log2_chroma_h <= 3);
 av_assert0(d->nb_components <= 4);
-av_assert2(av_get_pix_fmt(d->name) == i);
+av_assert2(av_get_pix_fmt(d->name) == av_pix_fmt_desc_get_id(d));
+
+/* The following two checks as well as the one after the loop
+ * would need to be changed if we changed the way the descriptors
+ * are stored. */
+av_assert0(i == av_pix_fmt_desc_get_id(d));
+av_assert0(!last || last + 1 == d);
 
-for (j=0; jcomp); j++) {
+for (int j = 0; j < FF_ARRAY_ELEMS(d->comp); j++) {
 const AVComponentDescriptor *c = &d->comp[j];
 if(j>=d->nb_components) {
 av_assert0(!c->plane && !c->step && !c->offset && !c->shift && 
!c->depth);
@@ -2947,7 +2953,9 @@ void ff_check_pixfmt_descriptors(void){
 tmp[0] = tmp[1] = (1ULL << c->depth) - 1;
 av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
 }
+last = d;
 }
+av_assert0(i == AV_PIX_FMT_NB);
 }
 
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/tests/pixelutils: Use av_assert0 instead for test tools

2022-09-30 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Sep 26 21:24:15 2022 +0200| [36e805e9df012c20641fac5914a058f9c5ae15fd] | 
committer: Andreas Rheinhardt

avutil/tests/pixelutils: Use av_assert0 instead for test tools

These are test tools, so they should be picky.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=36e805e9df012c20641fac5914a058f9c5ae15fd
---

 libavutil/tests/pixelutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/tests/pixelutils.c b/libavutil/tests/pixelutils.c
index 41663d3eda..e1b7dd19b2 100644
--- a/libavutil/tests/pixelutils.c
+++ b/libavutil/tests/pixelutils.c
@@ -47,7 +47,7 @@ static void check_pixfmt_descriptors(void)
 av_assert0(d->log2_chroma_w <= 3);
 av_assert0(d->log2_chroma_h <= 3);
 av_assert0(d->nb_components <= 4);
-av_assert2(av_get_pix_fmt(d->name) == av_pix_fmt_desc_get_id(d));
+av_assert0(av_get_pix_fmt(d->name) == av_pix_fmt_desc_get_id(d));
 
 /* The following two checks as well as the one after the loop
  * would need to be changed if we changed the way the descriptors

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/pixdesc: Move ff_check_pixfmt_descriptors() to its only user

2022-09-30 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Sep 26 21:05:00 2022 +0200| [5fe447bbb4a1dfebb6f19339764aeab0315ff17f] | 
committer: Andreas Rheinhardt

avutil/pixdesc: Move ff_check_pixfmt_descriptors() to its only user

Namely to lavu/tests/pixelutils.c. This way, this function will
not be included into actual binaries any more.

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5fe447bbb4a1dfebb6f19339764aeab0315ff17f
---

 libavutil/internal.h |  2 --
 libavutil/pixdesc.c  | 49 
 libavutil/tests/pixelutils.c | 53 +++-
 3 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index c9e30bc5e9..454c59aa50 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -187,6 +187,4 @@ static av_always_inline av_const int avpriv_mirror(int x, 
int w)
 return x;
 }
 
-void ff_check_pixfmt_descriptors(void);
-
 #endif /* AVUTIL_INTERNAL_H */
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 4f95f88aba..ca3e204a0b 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -22,12 +22,10 @@
 #include 
 #include 
 
-#include "avassert.h"
 #include "avstring.h"
 #include "common.h"
 #include "pixfmt.h"
 #include "pixdesc.h"
-#include "internal.h"
 #include "intreadwrite.h"
 
 void av_read_image_line2(void *dst,
@@ -2912,53 +2910,6 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
 return ret;
 }
 
-void ff_check_pixfmt_descriptors(void){
-const AVPixFmtDescriptor *d, *last = NULL;
-int i;
-
-for (i = AV_PIX_FMT_NONE, d = NULL; i++, d = av_pix_fmt_desc_next(d);) {
-uint8_t fill[4][8+6+3] = {{0}};
-uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
-int linesize[4] = {0,0,0,0};
-uint16_t tmp[2];
-
-av_assert0(d->name && d->name[0]);
-av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name);
-av_assert0(d->log2_chroma_w <= 3);
-av_assert0(d->log2_chroma_h <= 3);
-av_assert0(d->nb_components <= 4);
-av_assert2(av_get_pix_fmt(d->name) == av_pix_fmt_desc_get_id(d));
-
-/* The following two checks as well as the one after the loop
- * would need to be changed if we changed the way the descriptors
- * are stored. */
-av_assert0(i == av_pix_fmt_desc_get_id(d));
-av_assert0(!last || last + 1 == d);
-
-for (int j = 0; j < FF_ARRAY_ELEMS(d->comp); j++) {
-const AVComponentDescriptor *c = &d->comp[j];
-if(j>=d->nb_components) {
-av_assert0(!c->plane && !c->step && !c->offset && !c->shift && 
!c->depth);
-continue;
-}
-if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
-av_assert0(c->step >= c->depth);
-} else {
-av_assert0(8*c->step >= c->depth);
-}
-if (d->flags & AV_PIX_FMT_FLAG_BAYER)
-continue;
-av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
-av_assert0(tmp[0] == 0 && tmp[1] == 0);
-tmp[0] = tmp[1] = (1ULL << c->depth) - 1;
-av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
-}
-last = d;
-}
-av_assert0(i == AV_PIX_FMT_NB);
-}
-
-
 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
 {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
diff --git a/libavutil/tests/pixelutils.c b/libavutil/tests/pixelutils.c
index 927c8d9217..41663d3eda 100644
--- a/libavutil/tests/pixelutils.c
+++ b/libavutil/tests/pixelutils.c
@@ -18,15 +18,66 @@
 
 #include 
 
+#include "libavutil/avassert.h"
 #include "libavutil/internal.h"
+#include "libavutil/log.h"
 #include "libavutil/mem.h"
+#include "libavutil/pixdesc.h"
 #include "libavutil/pixelutils.c"
+#include "libavutil/pixfmt.h"
 
 #define W1 320
 #define H1 240
 #define W2 640
 #define H2 480
 
+static void check_pixfmt_descriptors(void)
+{
+const AVPixFmtDescriptor *d, *last = NULL;
+int i;
+
+for (i = AV_PIX_FMT_NONE, d = NULL; i++, d = av_pix_fmt_desc_next(d);) {
+uint8_t fill[4][8 + 6 + 3] = {{ 0 }};
+uint8_t *data[4] = { fill[0], fill[1], fill[2], fill[3] };
+int linesize[4] = { 0, 0, 0, 0 };
+uint16_t tmp[2];
+
+av_assert0(d->name && d->name[0]);
+av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name);
+av_assert0(d->log2_chroma_w <= 3);
+av_assert0(d->log2_chroma_h <= 3);
+av_assert0(d->nb_components <= 4);
+av_assert2(av_get_pix_fmt(d->name) == av_pix_fmt_desc_get_id(d));
+
+/* The following two checks as well as the one after the loop
+ * would need to be changed if we changed the way the descriptors
+ * are stored. */
+av_assert0(i == av_pix_fmt_desc_get_id(d));
+av_assert0(!last || last + 1 == d);

[FFmpeg-cvslog] avutil/tests/pixelutils: Test that all non-hw pix fmts have components

2022-09-30 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Mon Sep 26 21:42:31 2022 +0200| [9d52844aba797343e27ba6c35ca47aec459bdf22] | 
committer: Andreas Rheinhardt

avutil/tests/pixelutils: Test that all non-hw pix fmts have components

Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d52844aba797343e27ba6c35ca47aec459bdf22
---

 libavutil/tests/pixelutils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/tests/pixelutils.c b/libavutil/tests/pixelutils.c
index e1b7dd19b2..f5ddeb329d 100644
--- a/libavutil/tests/pixelutils.c
+++ b/libavutil/tests/pixelutils.c
@@ -47,6 +47,7 @@ static void check_pixfmt_descriptors(void)
 av_assert0(d->log2_chroma_w <= 3);
 av_assert0(d->log2_chroma_h <= 3);
 av_assert0(d->nb_components <= 4);
+av_assert0(d->nb_components || (d->flags & AV_PIX_FMT_FLAG_HWACCEL));
 av_assert0(av_get_pix_fmt(d->name) == av_pix_fmt_desc_get_id(d));
 
 /* The following two checks as well as the one after the loop

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/mjpegdec: remove not needed operations on channel identifiers

2022-09-30 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Sep 30 18:56:43 
2022 +0200| [9a494b82d998823d0de68cb6b8db83cc451d1781] | committer: Paul B Mahol

avcodec/mjpegdec: remove not needed operations on channel identifiers

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a494b82d998823d0de68cb6b8db83cc451d1781
---

 libavcodec/mjpegdec.c | 22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 559bda5e6f..85d1129f30 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -373,10 +373,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 s->v_max = 1;
 for (i = 0; i < nb_components; i++) {
 /* component id */
-int id = get_bits(&s->gb, 8);
-if (id == 0)
-return AVERROR_INVALIDDATA;
-s->component_id[i] = id - 1;
+s->component_id[i] = get_bits(&s->gb, 8);
 h_count[i] = get_bits(&s->gb, 4);
 v_count[i] = get_bits(&s->gb, 4);
 /* compute hmax and vmax (only used in interleaved case) */
@@ -401,10 +398,10 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s->component_id[i], s->quant_index[i]);
 }
 if (   nb_components == 4
-&& s->component_id[0] == 'C' - 1
-&& s->component_id[1] == 'M' - 1
-&& s->component_id[2] == 'Y' - 1
-&& s->component_id[3] == 'K' - 1)
+&& s->component_id[0] == 'C'
+&& s->component_id[1] == 'M'
+&& s->component_id[2] == 'Y'
+&& s->component_id[3] == 'K')
 s->adobe_transform = 0;
 
 if (s->ls && (s->h_max > 1 || s->v_max > 1)) {
@@ -526,7 +523,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_BGR24 : 
AV_PIX_FMT_BGR48;
 else {
 if (   s->adobe_transform == 0
-|| s->component_id[0] == 'R' - 1 && s->component_id[1] == 
'G' - 1 && s->component_id[2] == 'B' - 1) {
+|| s->component_id[0] == 'R' && s->component_id[1] == 'G' 
&& s->component_id[2] == 'B') {
 s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP : 
AV_PIX_FMT_GBRP16;
 } else {
 if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
@@ -599,7 +596,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 case 0x1400:
 case 0x22211100:
 case 0x22112100:
-if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && 
s->component_id[2] == 'A') {
+if (s->component_id[0] == 'R' && s->component_id[1] == 'G' && 
s->component_id[B] == 'B') {
 if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
 else
 goto unk_pixfmt;
@@ -614,7 +611,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 }
 break;
 case 0x2100:
-if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && 
s->component_id[2] == 'A') {
+if (s->component_id[0] == 'R' && s->component_id[1] == 'G' && 
s->component_id[2] == 'B') {
 if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
 else
 goto unk_pixfmt;
@@ -1681,9 +1678,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const 
uint8_t *mb_bitmask,
 }
 for (i = 0; i < nb_components; i++) {
 id = get_bits(&s->gb, 8);
-if (id == 0)
-return AVERROR_INVALIDDATA;
-id -= 1;
 av_log(s->avctx, AV_LOG_DEBUG, "component: %d\n", id);
 /* find component index */
 for (index = 0; index < s->nb_components; index++)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec: add Media 100i decoder

2022-09-30 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Sep 21 18:22:33 
2022 +0200| [4b6b75c7526e644e3516a79f0379b2e2f75a054d] | committer: Paul B Mahol

avcodec: add Media 100i decoder

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4b6b75c7526e644e3516a79f0379b2e2f75a054d
---

 Changelog   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/codec_id.h   |   1 +
 libavcodec/media100.c   | 224 
 libavcodec/version.h|   2 +-
 libavformat/isom_tags.c |   7 ++
 8 files changed, 243 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 8360492abe..3c28bcd991 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ version :
 - Micronas SC-4 audio decoder
 - LAF demuxer
 - APAC decoder and demuxer
+- Media 100i decoders
 
 
 version 5.1:
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 14434dc06c..1946930c20 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -469,6 +469,7 @@ OBJS-$(CONFIG_MACE6_DECODER)   += mace.o
 OBJS-$(CONFIG_MAGICYUV_DECODER)+= magicyuv.o
 OBJS-$(CONFIG_MAGICYUV_ENCODER)+= magicyuvenc.o
 OBJS-$(CONFIG_MDEC_DECODER)+= mdec.o mpeg12.o mpeg12data.o
+OBJS-$(CONFIG_MEDIA100_DECODER)+= media100.o
 OBJS-$(CONFIG_METASOUND_DECODER)   += metasound.o metasound_data.o \
   twinvq.o
 OBJS-$(CONFIG_MICRODVD_DECODER)+= microdvddec.o ass.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 3454823a05..cfeb01ac1c 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -194,6 +194,7 @@ extern const FFCodec ff_m101_decoder;
 extern const FFCodec ff_magicyuv_encoder;
 extern const FFCodec ff_magicyuv_decoder;
 extern const FFCodec ff_mdec_decoder;
+extern const FFCodec ff_media100_decoder;
 extern const FFCodec ff_mimic_decoder;
 extern const FFCodec ff_mjpeg_encoder;
 extern const FFCodec ff_mjpeg_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index ee47489b75..93b18f9072 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1909,6 +1909,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("WBMP (Wireless Application Protocol 
Bitmap) image"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_MEDIA100,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "media100",
+.long_name = NULL_IF_CONFIG_SMALL("Media 100i"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index a0a720f9ff..82874daaa3 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -318,6 +318,7 @@ enum AVCodecID {
 AV_CODEC_ID_PHM,
 AV_CODEC_ID_RADIANCE_HDR,
 AV_CODEC_ID_WBMP,
+AV_CODEC_ID_MEDIA100,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/media100.c b/libavcodec/media100.c
new file mode 100644
index 00..fdfce2cac1
--- /dev/null
+++ b/libavcodec/media100.c
@@ -0,0 +1,224 @@
+/*
+ * Media 100 decoder
+ * Copyright (c) 2022 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Media 100 decoder.
+ */
+
+#include 
+
+#include "libavutil/intreadwrite.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "codec_internal.h"
+
+typedef struct Media100Context {
+AVCodecContext *avctx;   // wrapper context for mjpegb
+AVPacket *pkt;
+} Media100Context;
+
+static av_cold int media100_decode_init(AVCodecContext *avctx)
+{
+Media100Context *ctx = avctx->priv_data;
+const AVCodec *codec;
+int ret;
+
+codec = avcodec_find_decoder(AV_CODEC_ID_MJPEGB);
+if (!codec)
+return AVERROR_BUG;
+ctx->avctx = avcodec_alloc_context3(codec);
+if (!ctx->avctx)
+return AVERROR(ENOMEM);
+ctx->avctx->thread_count = 1;
+ctx->avctx->flags  = avctx->flags;
+ctx->avctx->flags2 = avctx->flags2;
+ctx->avctx->widt

[FFmpeg-cvslog] avcodec/mjpegdec: Fix compilation

2022-09-30 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Sep 30 19:22:05 2022 +0200| [b0c7352cd494c88d33f032be60b5e1c4e8b092a0] | 
committer: Andreas Rheinhardt

avcodec/mjpegdec: Fix compilation

Regression since 9a494b82d998823d0de68cb6b8db83cc451d1781.

Reviewed-by: James Almer 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b0c7352cd494c88d33f032be60b5e1c4e8b092a0
---

 libavcodec/mjpegdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 85d1129f30..3374ae71bd 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -596,7 +596,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 case 0x1400:
 case 0x22211100:
 case 0x22112100:
-if (s->component_id[0] == 'R' && s->component_id[1] == 'G' && 
s->component_id[B] == 'B') {
+if (s->component_id[0] == 'R' && s->component_id[1] == 'G' && 
s->component_id[2] == 'B') {
 if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
 else
 goto unk_pixfmt;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".