diff options
Diffstat (limited to 'media/libstagefright/codecs/m4v_h263/dec')
4 files changed, 23 insertions, 12 deletions
diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp index 1f4b6fd..ede645c 100644 --- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp +++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp @@ -21,6 +21,7 @@ #include "SoftMPEG4.h" #include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/AUtils.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/IOMX.h> @@ -70,7 +71,7 @@ SoftMPEG4::SoftMPEG4( mPvTime(0) { initPorts( kNumInputBuffers, - 8192 /* inputBufferSize */, + 352 * 288 * 3 / 2 /* minInputBufferSize */, kNumOutputBuffers, (mMode == MODE_MPEG4) ? MEDIA_MIMETYPE_VIDEO_MPEG4 : MEDIA_MIMETYPE_VIDEO_H263); @@ -353,14 +354,14 @@ void SoftMPEG4::onReset() { } } -void SoftMPEG4::updatePortDefinitions() { - SoftVideoDecoderOMXComponent::updatePortDefinitions(); +void SoftMPEG4::updatePortDefinitions(bool updateCrop, bool updateInputSize) { + SoftVideoDecoderOMXComponent::updatePortDefinitions(updateCrop, updateInputSize); /* We have to align our width and height - this should affect stride! */ OMX_PARAM_PORTDEFINITIONTYPE *def = &editPortInfo(kOutputPortIndex)->mDef; - def->nBufferSize = - (((def->format.video.nFrameWidth + 15) & -16) - * ((def->format.video.nFrameHeight + 15) & -16) * 3) / 2; + def->format.video.nStride = align(def->format.video.nStride, 16); + def->format.video.nSliceHeight = align(def->format.video.nSliceHeight, 16); + def->nBufferSize = (def->format.video.nStride * def->format.video.nSliceHeight * 3) / 2; } } // namespace android @@ -382,5 +383,6 @@ android::SoftOMXComponent *createSoftOMXComponent( } else { CHECK(!"Unknown component"); } + return NULL; } diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h index 8a06a00..4114e7d 100644 --- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h +++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h @@ -66,7 +66,7 @@ private: status_t initDecoder(); - virtual void updatePortDefinitions(); + virtual void updatePortDefinitions(bool updateCrop = true, bool updateInputSize = false); bool handlePortSettingsChange(); DISALLOW_EVIL_CONSTRUCTORS(SoftMPEG4); diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp index 30d5cbd..c1720c6 100644 --- a/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp +++ b/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp @@ -265,10 +265,13 @@ OSCL_EXPORT_REF Bool PVInitVideoDecoder(VideoDecControls *decCtrl, uint8 *volbuf video->vol[idx]->useReverseVLC = 0; video->intra_acdcPredDisable = 1; video->vol[idx]->scalability = 0; - video->size = (int32)width * height; - video->displayWidth = video->width = width; - video->displayHeight = video->height = height; + video->displayWidth = width; + video->displayHeight = height; + video->width = (width + 15) & -16; + video->height = (height + 15) & -16; + video->size = (int32)video->width * video->height; + #ifdef PV_ANNEX_IJKT_SUPPORT video->modified_quant = 0; video->advanced_INTRA = 0; @@ -308,8 +311,10 @@ Bool PVAllocVideoData(VideoDecControls *decCtrl, int width, int height, int nLay if (video->shortVideoHeader == PV_TRUE) { - video->displayWidth = video->width = width; - video->displayHeight = video->height = height; + video->displayWidth = width; + video->displayHeight = height; + video->width = (width + 15) & -16; + video->height = (height + 15) & -16; video->nMBPerRow = video->nMBinGOB = video->width / MB_SIZE; diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp index b03ec8c..60c79a6 100644 --- a/media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp +++ b/media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp @@ -118,6 +118,10 @@ PV_STATUS DecodeVOLHeader(VideoDecData *video, int layer) { /* support SPL0-3 & SSPL0-2 */ if (tmpvar != 0x01 && tmpvar != 0x02 && tmpvar != 0x03 && tmpvar != 0x08 && + /* While not technically supported, try to decode SPL4&SPL5 files as well. */ + /* We'll fail later if the size is too large. This is to allow playback of */ + /* some <=CIF files generated by other encoders. */ + tmpvar != 0x04 && tmpvar != 0x05 && tmpvar != 0x10 && tmpvar != 0x11 && tmpvar != 0x12 && tmpvar != 0x21 && tmpvar != 0x22 && /* Core Profile Levels */ tmpvar != 0xA1 && tmpvar != 0xA2 && tmpvar != 0xA3 && |