Commit 1c396a3d authored by fbarchard@google.com's avatar fbarchard@google.com

MJPGSize function to query size.

BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/898004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@425 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 02e48bf7
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 424 Version: 425
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -205,6 +205,11 @@ int MJPGToI420(const uint8* sample, size_t sample_size, ...@@ -205,6 +205,11 @@ int MJPGToI420(const uint8* sample, size_t sample_size,
uint8* dst_v, int dst_stride_v, uint8* dst_v, int dst_stride_v,
int src_width, int src_height, int src_width, int src_height,
int dst_width, int dst_height); int dst_width, int dst_height);
// Query size of MJPG in pixels.
LIBYUV_API
int MJPGSize(const uint8* sample, size_t sample_size,
int* width, int* height);
#endif #endif
// Note Bayer formats (BGGR) To I420 are in format_conversion.h // Note Bayer formats (BGGR) To I420 are in format_conversion.h
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 424 #define LIBYUV_VERSION 425
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -1567,6 +1567,21 @@ static void JpegI400ToI420(void* opaque, ...@@ -1567,6 +1567,21 @@ static void JpegI400ToI420(void* opaque,
dest->h -= rows; dest->h -= rows;
} }
// Query size of MJPG in pixels.
LIBYUV_API
int MJPGSize(const uint8* sample, size_t sample_size,
int* width, int* height) {
// TODO(fbarchard): Port to C
MJpegDecoder mjpeg_decoder;
bool ret = mjpeg_decoder.LoadFrame(sample, sample_size);
if (ret) {
*width = mjpeg_decoder.GetWidth();
*height = mjpeg_decoder.GetHeight();
}
mjpeg_decoder.UnloadFrame();
return ret ? 0 : -1; // -1 for runtime failure.
}
// MJPG (Motion JPeg) to I420 // MJPG (Motion JPeg) to I420
// TODO(fbarchard): review w and h requirement. dw and dh may be enough. // TODO(fbarchard): review w and h requirement. dw and dh may be enough.
LIBYUV_API LIBYUV_API
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment