On Thu, Jun 27, 2019 at 08:59:12PM +0800, Zhong Li wrote: > It will be reused in the following mjpeg_parser patch > > Signed-off-by: Zhong Li <zhong...@intel.com> > --- > Mark Thompson: This seems suspicious - MJPEG is generally 4:2:2 (e.g. UVC > requires it), so I would expect a 4:2:2 format to be the default here? (Or > maybe a longer list - VAAPI certainly supports 4:2:2, 4:2:0 and 4:4:4 on the > same hardware.) > Zhong: libmfx can support jpeg baseline profile with more output formats, but > current ffmpeg-qsv decoder/vpp can't. Will extend supported format list as > separated patch. > > libavcodec/mjpegdec.c | 37 ++++++++++++++++++++++++++++--------- > libavcodec/mjpegdec.h | 4 ++++ > 2 files changed, 32 insertions(+), 9 deletions(-) > > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > index a65bc8d..5da66bb 100644 > --- a/libavcodec/mjpegdec.c > +++ b/libavcodec/mjpegdec.c > @@ -157,6 +157,8 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) > s->start_code = -1; > s->first_picture = 1; > s->got_picture = 0; > + s->reinit_idct = 0; > + s->size_change = 0; > s->org_height = avctx->coded_height; > avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; > avctx->colorspace = AVCOL_SPC_BT470BG; > @@ -302,9 +304,9 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) > return 0; > } > > -int ff_mjpeg_decode_sof(MJpegDecodeContext *s) > +int ff_mjpeg_decode_header(MJpegDecodeContext *s) > { > - int len, nb_components, i, width, height, bits, ret, size_change; > + int len, nb_components, i, width, height, bits, ret; > unsigned pix_fmt_id; > int h_count[MAX_COMPONENTS] = { 0 }; > int v_count[MAX_COMPONENTS] = { 0 }; > @@ -324,7 +326,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) > if (s->avctx->bits_per_raw_sample != bits) { > av_log(s->avctx, s->avctx->bits_per_raw_sample > 0 ? AV_LOG_INFO : > AV_LOG_DEBUG, "Changing bps from %d to %d\n", s->avctx->bits_per_raw_sample, > bits); > s->avctx->bits_per_raw_sample = bits; > - init_idct(s->avctx); > + s->reinit_idct = 1; > }
I think the avctx->bits_per_raw_sample value should stay in sync with the initialized idct This patch would allow the bits_per_raw_sample to change and then a subsequent error to skip init_idct() maybe this is ok as it would be probably called later in a subsequent frame but i think its better if they stay closer together or there is nothing between them that can cause ine to exeucute without the other [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Whats the most studid thing your enemy could do ? Blow himself up Whats the most studid thing you could do ? Give up your rights and freedom because your enemy blew himself up.
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".