Rename YV12 to I420.
Change-Id: I453b7044bf46950ef67091f3417ed3e6a65086a0
diff --git a/libvideoeditor/include/IYV12ColorConverter.h b/libvideoeditor/include/II420ColorConverter.h
similarity index 75%
rename from libvideoeditor/include/IYV12ColorConverter.h
rename to libvideoeditor/include/II420ColorConverter.h
index e8f497a..33af61f 100644
--- a/libvideoeditor/include/IYV12ColorConverter.h
+++ b/libvideoeditor/include/II420ColorConverter.h
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#ifndef IYV12_COLOR_CONVERTER_H
+#ifndef II420_COLOR_CONVERTER_H
-#define IYV12_COLOR_CONVERTER_H
+#define II420_COLOR_CONVERTER_H
#include <stdint.h>
#include <android/rect.h>
@@ -25,19 +25,19 @@
extern "C" {
#endif
-typedef struct IYV12ColorConverter {
+typedef struct II420ColorConverter {
/*
* getDecoderOutputFormat
* Returns the color format (OMX_COLOR_FORMATTYPE) of the decoder output.
- * If it is YV12 (OMX_COLOR_FormatYUV420Planar), no conversion is needed,
- * and convertDecoderOutputToYV12() can be a no-op.
+ * If it is I420 (OMX_COLOR_FormatYUV420Planar), no conversion is needed,
+ * and convertDecoderOutputToI420() can be a no-op.
*/
int (*getDecoderOutputFormat)();
/*
- * convertDecoderOutputToYV12
- * @Desc Converts from the decoder output format to YV12 format.
+ * convertDecoderOutputToI420
+ * @Desc Converts from the decoder output format to I420 format.
* @note Caller (e.g. VideoEditor) owns the buffers
* @param decoderBits (IN) Pointer to the buffer contains decoder output
* @param decoderWidth (IN) Buffer width, as reported by the decoder
@@ -46,29 +46,29 @@
* metadata (kKeyHeight)
* @param decoderRect (IN) The rectangle of the actual frame, as
* reported by decoder metadata (kKeyCropRect)
- * @param dstBits (OUT) Pointer to the output YV12 buffer
+ * @param dstBits (OUT) Pointer to the output I420 buffer
* @return -1 Any error
* @return 0 No Error
*/
- int (*convertDecoderOutputToYV12)(
+ int (*convertDecoderOutputToI420)(
void* decoderBits, int decoderWidth, int decoderHeight,
ARect decoderRect, void* dstBits);
/*
* getEncoderIntputFormat
* Returns the color format (OMX_COLOR_FORMATTYPE) of the encoder input.
- * If it is YV12 (OMX_COLOR_FormatYUV420Planar), no conversion is needed,
- * and convertYV12ToEncoderInput() and getEncoderInputBufferInfo() can
+ * If it is I420 (OMX_COLOR_FormatYUV420Planar), no conversion is needed,
+ * and convertI420ToEncoderInput() and getEncoderInputBufferInfo() can
* be no-ops.
*/
int (*getEncoderInputFormat)();
- /* convertYV12ToEncoderInput
- * @Desc This function converts from YV12 to the encoder input format
+ /* convertI420ToEncoderInput
+ * @Desc This function converts from I420 to the encoder input format
* @note Caller (e.g. VideoEditor) owns the buffers
- * @param srcBits (IN) Pointer to the input YV12 buffer
- * @param srcWidth (IN) Width of the YV12 frame
- * @param srcHeight (IN) Height of the YV12 frame
+ * @param srcBits (IN) Pointer to the input I420 buffer
+ * @param srcWidth (IN) Width of the I420 frame
+ * @param srcHeight (IN) Height of the I420 frame
* @param encoderWidth (IN) Encoder buffer width, as calculated by
* getEncoderBufferInfo()
* @param encoderHeight (IN) Encoder buffer height, as calculated by
@@ -82,29 +82,29 @@
* @return -1 Any error
* @return 0 No Error
*/
- int (*convertYV12ToEncoderInput)(
+ int (*convertI420ToEncoderInput)(
void* srcBits, int srcWidth, int srcHeight,
int encoderWidth, int encoderHeight, ARect encoderRect,
void* encoderBits);
/* getEncoderInputBufferInfo
* @Desc This function returns metadata for the encoder input buffer
- * based on the actual YV12 frame width and height.
+ * based on the actual I420 frame width and height.
* @note This API should be be used to obtain the necessary information
- * before calling convertYV12ToEncoderInput().
- * VideoEditor knows only the width and height of the YV12 buffer,
+ * before calling convertI420ToEncoderInput().
+ * VideoEditor knows only the width and height of the I420 buffer,
* but it also needs know the width, height, and size of the
* encoder input buffer. The encoder input buffer width and height
* are used to set the metadata for the encoder.
- * @param srcWidth (IN) Width of the YV12 frame
- * @param srcHeight (IN) Height of the YV12 frame
+ * @param srcWidth (IN) Width of the I420 frame
+ * @param srcHeight (IN) Height of the I420 frame
* @param encoderWidth (OUT) Encoder buffer width needed
* @param encoderHeight (OUT) Encoder buffer height needed
* @param encoderRect (OUT) Rect coordinates of the actual frame inside
* the encoder buffer
* @param encoderBufferSize (OUT) The size of the buffer that need to be
* allocated by the caller before invoking
- * convertYV12ToEncoderInput().
+ * convertI420ToEncoderInput().
* @return -1 Any error
* @return 0 No Error
*/
@@ -113,14 +113,14 @@
int* encoderWidth, int* encoderHeight,
ARect* encoderRect, int* encoderBufferSize);
-} IYV12ColorConverter;
+} II420ColorConverter;
/* The only function that the shared library needs to expose: It fills the
- function pointers in IYV12ColorConverter */
-void getYV12ColorConverter(IYV12ColorConverter *converter);
+ function pointers in II420ColorConverter */
+void getI420ColorConverter(II420ColorConverter *converter);
#if defined(__cplusplus)
}
#endif
-#endif // IYV12_COLOR_CONVERTER_H
+#endif // II420_COLOR_CONVERTER_H
diff --git a/libvideoeditor/lvpp/Android.mk b/libvideoeditor/lvpp/Android.mk
index 7478ba5..fdcd316 100755
--- a/libvideoeditor/lvpp/Android.mk
+++ b/libvideoeditor/lvpp/Android.mk
@@ -37,7 +37,7 @@
AudioPlayerBase.cpp \
PreviewPlayerBase.cpp \
PreviewRenderer.cpp \
- YV12ColorConverter.cpp \
+ I420ColorConverter.cpp \
NativeWindowRenderer.cpp
LOCAL_MODULE_TAGS := optional
diff --git a/libvideoeditor/lvpp/YV12ColorConverter.cpp b/libvideoeditor/lvpp/I420ColorConverter.cpp
similarity index 62%
rename from libvideoeditor/lvpp/YV12ColorConverter.cpp
rename to libvideoeditor/lvpp/I420ColorConverter.cpp
index 07fa063..75f1e93 100755
--- a/libvideoeditor/lvpp/YV12ColorConverter.cpp
+++ b/libvideoeditor/lvpp/I420ColorConverter.cpp
@@ -14,41 +14,41 @@
* limitations under the License.
*/
-#include <YV12ColorConverter.h>
+#include <I420ColorConverter.h>
#include <cutils/log.h>
#include <dlfcn.h>
-YV12ColorConverter::YV12ColorConverter() {
+I420ColorConverter::I420ColorConverter() {
// Open the shared library
- mHandle = dlopen("libyv12colorconvert.so", RTLD_NOW);
+ mHandle = dlopen("libI420colorconvert.so", RTLD_NOW);
if (mHandle == NULL) {
- LOGW("YV12ColorConverter: cannot load libyv12colorconvert.so");
+ LOGW("I420ColorConverter: cannot load libI420colorconvert.so");
return;
}
// Find the entry point
- void (*getYV12ColorConverter)(YV12ColorConverter *converter) =
- (void (*)(YV12ColorConverter*)) dlsym(mHandle, "getYV12ColorConverter");
+ void (*getI420ColorConverter)(I420ColorConverter *converter) =
+ (void (*)(I420ColorConverter*)) dlsym(mHandle, "getI420ColorConverter");
- if (getYV12ColorConverter == NULL) {
- LOGW("YV12ColorConverter: cannot load getYV12ColorConverter");
+ if (getI420ColorConverter == NULL) {
+ LOGW("I420ColorConverter: cannot load getI420ColorConverter");
dlclose(mHandle);
mHandle = NULL;
return;
}
// Fill the function pointers.
- getYV12ColorConverter(this);
+ getI420ColorConverter(this);
- LOGI("YV12ColorConverter: libyv12colorconvert.so loaded");
+ LOGI("I420ColorConverter: libI420colorconvert.so loaded");
}
-bool YV12ColorConverter::isLoaded() {
+bool I420ColorConverter::isLoaded() {
return mHandle != NULL;
}
-YV12ColorConverter::~YV12ColorConverter() {
+I420ColorConverter::~I420ColorConverter() {
if (mHandle) {
dlclose(mHandle);
}
diff --git a/libvideoeditor/lvpp/YV12ColorConverter.h b/libvideoeditor/lvpp/I420ColorConverter.h
similarity index 67%
rename from libvideoeditor/lvpp/YV12ColorConverter.h
rename to libvideoeditor/lvpp/I420ColorConverter.h
index 32b52f7..8d48e44 100755
--- a/libvideoeditor/lvpp/YV12ColorConverter.h
+++ b/libvideoeditor/lvpp/I420ColorConverter.h
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-#ifndef YV12_COLOR_CONVERTER_H
-#define YV12_COLOR_CONVERTER_H
+#ifndef I420_COLOR_CONVERTER_H
+#define I420_COLOR_CONVERTER_H
-#include <IYV12ColorConverter.h>
+#include <II420ColorConverter.h>
-// This is a wrapper around the YV12 color converter functions in
-// IYV12ColorConverter, which is loaded from a shared library.
-class YV12ColorConverter: public IYV12ColorConverter {
+// This is a wrapper around the I420 color converter functions in
+// II420ColorConverter, which is loaded from a shared library.
+class I420ColorConverter: public II420ColorConverter {
public:
- YV12ColorConverter();
- ~YV12ColorConverter();
+ I420ColorConverter();
+ ~I420ColorConverter();
// Returns true if the converter functions are successfully loaded.
bool isLoaded();
@@ -32,4 +32,4 @@
void* mHandle;
};
-#endif /* YV12_COLOR_CONVERTER_H */
+#endif /* I420_COLOR_CONVERTER_H */
diff --git a/libvideoeditor/lvpp/NativeWindowRenderer.cpp b/libvideoeditor/lvpp/NativeWindowRenderer.cpp
index cde8b89..23d9506 100755
--- a/libvideoeditor/lvpp/NativeWindowRenderer.cpp
+++ b/libvideoeditor/lvpp/NativeWindowRenderer.cpp
@@ -409,12 +409,12 @@
// Copy the buffer
uint8_t* img = NULL;
buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
- copyYV12Buffer(buffer, img, width, height, buf->getStride());
+ copyI420Buffer(buffer, img, width, height, buf->getStride());
buf->unlock();
CHECK(NO_ERROR == anw->queueBuffer(anw, buf->getNativeBuffer()));
}
-void NativeWindowRenderer::copyYV12Buffer(MediaBuffer* src, uint8_t* dst,
+void NativeWindowRenderer::copyI420Buffer(MediaBuffer* src, uint8_t* dst,
int srcWidth, int srcHeight, int stride) {
int strideUV = (stride / 2 + 0xf) & ~0xf;
uint8_t* p = (uint8_t*)src->data() + src->range_offset();
diff --git a/libvideoeditor/lvpp/NativeWindowRenderer.h b/libvideoeditor/lvpp/NativeWindowRenderer.h
index 2af19a3..cafd6fb 100755
--- a/libvideoeditor/lvpp/NativeWindowRenderer.h
+++ b/libvideoeditor/lvpp/NativeWindowRenderer.h
@@ -76,7 +76,7 @@
void queueInternalBuffer(ANativeWindow* anw, MediaBuffer* buffer);
void queueExternalBuffer(ANativeWindow* anw, MediaBuffer* buffer,
int width, int height);
- void copyYV12Buffer(MediaBuffer* src, uint8_t* dst,
+ void copyI420Buffer(MediaBuffer* src, uint8_t* dst,
int srcWidth, int srcHeight, int stride);
void updateProgramAndHandle(uint32_t videoEffect);
void calculatePositionCoordinates(M4xVSS_MediaRendering renderingMode,
diff --git a/libvideoeditor/vss/stagefrightshells/inc/VideoEditorVideoDecoder_internal.h b/libvideoeditor/vss/stagefrightshells/inc/VideoEditorVideoDecoder_internal.h
index 55d536d..9be6cbd 100755
--- a/libvideoeditor/vss/stagefrightshells/inc/VideoEditorVideoDecoder_internal.h
+++ b/libvideoeditor/vss/stagefrightshells/inc/VideoEditorVideoDecoder_internal.h
@@ -35,7 +35,7 @@
#include "M4OSA_Semaphore.h"
#include "VideoEditorBuffer.h"
#include "M4VD_Tools.h"
-#include "YV12ColorConverter.h"
+#include "I420ColorConverter.h"
#include <utils/RefBase.h>
#include <android/rect.h>
@@ -112,7 +112,7 @@
M4OSA_Int32 mGivenWidth, mGivenHeight; //Used in case of
//INFO_FORMAT_CHANGED
ARect mCropRect; // These are obtained from kKeyCropRect.
- YV12ColorConverter* mYV12ColorConverter;
+ I420ColorConverter* mI420ColorConverter;
} VideoEditorVideoDecoder_Context;
diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoDecoder.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoDecoder.cpp
index 42cfa65..3447c2c 100755
--- a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoDecoder.cpp
+++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoDecoder.cpp
@@ -788,7 +788,7 @@
VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER);
// Release the color converter
- delete pDecShellContext->mYV12ColorConverter;
+ delete pDecShellContext->mI420ColorConverter;
// Destroy the graph
if( pDecShellContext->mVideoDecoder != NULL ) {
@@ -943,14 +943,14 @@
pDecShellContext->m_pVideoStreamhandler->m_videoHeight);
// Get the color converter
- pDecShellContext->mYV12ColorConverter = new YV12ColorConverter;
- if (pDecShellContext->mYV12ColorConverter->isLoaded()) {
- decoderOutput = pDecShellContext->mYV12ColorConverter->getDecoderOutputFormat();
+ pDecShellContext->mI420ColorConverter = new I420ColorConverter;
+ if (pDecShellContext->mI420ColorConverter->isLoaded()) {
+ decoderOutput = pDecShellContext->mI420ColorConverter->getDecoderOutputFormat();
}
if (decoderOutput == OMX_COLOR_FormatYUV420Planar) {
- delete pDecShellContext->mYV12ColorConverter;
- pDecShellContext->mYV12ColorConverter = NULL;
+ delete pDecShellContext->mI420ColorConverter;
+ pDecShellContext->mI420ColorConverter = NULL;
}
LOGI("decoder output format = 0x%X\n", decoderOutput);
@@ -1412,14 +1412,14 @@
break;
}
default:
- if (pDecShellContext->mYV12ColorConverter) {
- if (pDecShellContext->mYV12ColorConverter->convertDecoderOutputToYV12(
+ if (pDecShellContext->mI420ColorConverter) {
+ if (pDecShellContext->mI420ColorConverter->convertDecoderOutputToI420(
(uint8_t *)pDecoderBuffer->data(),// ?? + pDecoderBuffer->range_offset(), // decoderBits
pDecShellContext->mGivenWidth, // decoderWidth
pDecShellContext->mGivenHeight, // decoderHeight
pDecShellContext->mCropRect, // decoderRect
tmpDecBuffer->pData /* dstBits */) < 0) {
- LOGE("convertDecoderOutputToYV12 failed");
+ LOGE("convertDecoderOutputToI420 failed");
}
} else {
LOGW("VideoDecoder_decode: unexpected color format 0x%X",
diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp
index c05aa41..abfd16b 100755
--- a/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp
+++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditorVideoEncoder.cpp
@@ -29,7 +29,7 @@
#include "M4SYS_AccessUnit.h"
#include "VideoEditorVideoEncoder.h"
#include "VideoEditorUtils.h"
-#include <YV12ColorConverter.h>
+#include <I420ColorConverter.h>
#include "utils/Log.h"
#include "utils/Vector.h"
@@ -455,7 +455,7 @@
sp<MediaSource> mEncoder;
OMX_COLOR_FORMATTYPE mEncoderColorFormat;
VideoEditorVideoEncoderPuller* mPuller;
- YV12ColorConverter* mYV12ColorConverter;
+ I420ColorConverter* mI420ColorConverter;
uint32_t mNbInputFrames;
double mFirstInputCts;
@@ -628,13 +628,13 @@
pEncoderContext->mPuller = NULL;
// Get color converter and determine encoder input format
- pEncoderContext->mYV12ColorConverter = new YV12ColorConverter;
- if (pEncoderContext->mYV12ColorConverter->isLoaded()) {
- encoderInput = pEncoderContext->mYV12ColorConverter->getEncoderInputFormat();
+ pEncoderContext->mI420ColorConverter = new I420ColorConverter;
+ if (pEncoderContext->mI420ColorConverter->isLoaded()) {
+ encoderInput = pEncoderContext->mI420ColorConverter->getEncoderInputFormat();
}
if (encoderInput == OMX_COLOR_FormatYUV420Planar) {
- delete pEncoderContext->mYV12ColorConverter;
- pEncoderContext->mYV12ColorConverter = NULL;
+ delete pEncoderContext->mI420ColorConverter;
+ pEncoderContext->mI420ColorConverter = NULL;
}
pEncoderContext->mEncoderColorFormat = (OMX_COLOR_FORMATTYPE)encoderInput;
LOGI("encoder input format = 0x%X\n", encoderInput);
@@ -704,8 +704,8 @@
delete pEncoderContext->mPuller;
pEncoderContext->mPuller = NULL;
- delete pEncoderContext->mYV12ColorConverter;
- pEncoderContext->mYV12ColorConverter = NULL;
+ delete pEncoderContext->mI420ColorConverter;
+ pEncoderContext->mI420ColorConverter = NULL;
// Set the new state
pEncoderContext->mState = CREATED;
@@ -928,8 +928,8 @@
VIDEOEDITOR_CHECK(M4NO_ERROR == err, err);
// Convert MediaBuffer to the encoder input format if necessary
- if (pEncoderContext->mYV12ColorConverter) {
- YV12ColorConverter* converter = pEncoderContext->mYV12ColorConverter;
+ if (pEncoderContext->mI420ColorConverter) {
+ I420ColorConverter* converter = pEncoderContext->mI420ColorConverter;
int actualWidth = pEncoderContext->mCodecParams->FrameWidth;
int actualHeight = pEncoderContext->mCodecParams->FrameHeight;
@@ -944,13 +944,13 @@
MediaBuffer* newBuffer = new MediaBuffer(encoderBufferSize);
- if (converter->convertYV12ToEncoderInput(
+ if (converter->convertI420ToEncoderInput(
pData, // srcBits
actualWidth, actualHeight,
encoderWidth, encoderHeight,
encoderRect,
(uint8_t*)newBuffer->data() + newBuffer->range_offset()) < 0) {
- LOGE("convertYV12ToEncoderInput failed");
+ LOGE("convertI420ToEncoderInput failed");
}
// switch to new buffer