Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1627)

Unified Diff: content/common/gpu/media/vaapi_wrapper.cc

Issue 825843002: Add JPEG decoder for VAAPI JPEG decode acceleration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mjpeg-vaapi-jpeg-parser
Patch Set: rebase+revise due to parser cl Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/vaapi_wrapper.cc
diff --git a/content/common/gpu/media/vaapi_wrapper.cc b/content/common/gpu/media/vaapi_wrapper.cc
index 2b4b33349aa12a3d77ed7680c06f18ad6e1bd775..b66f5344adf52d7f938f9d5341034548e25e8a56 100644
--- a/content/common/gpu/media/vaapi_wrapper.cc
+++ b/content/common/gpu/media/vaapi_wrapper.cc
@@ -69,6 +69,7 @@ static const ProfileMap kProfileMap[] = {
// TODO(posciak): See if we can/want support other variants of
// media::H264PROFILE_HIGH*.
{media::H264PROFILE_HIGH, VAProfileH264High},
+ {media::MJPEGPROFILE, VAProfileJPEGBaseline},
};
static std::vector<VAConfigAttrib> GetRequiredAttribs(
@@ -619,6 +620,40 @@ bool VaapiWrapper::GetVaImageForTesting(VASurfaceID va_surface_id,
return false;
}
+bool VaapiWrapper::GetVaImageWithFormat(VASurfaceID va_surface_id,
wuchengli 2015/01/12 09:08:53 Is CreateVaImage better? This actually passes form
kcwu 2015/01/16 15:12:56 Done. In order to emphasis its difference to GetVa
+ VAImageFormat* format,
+ gfx::Size size,
+ VAImage* image,
+ void** mem) {
+ base::AutoLock auto_lock(va_lock_);
+
+ VAStatus va_res = vaSyncSurface(va_display_, va_surface_id);
+ VA_SUCCESS_OR_RETURN(va_res, "Failed syncing surface", false);
+
+ va_res =
+ vaCreateImage(va_display_, format, size.width(), size.height(), image);
+ VA_LOG_ON_ERROR(va_res, "vaCreateImage failed");
wuchengli 2015/01/12 09:08:53 VA_SUCCESS_OR_RETURN
kcwu 2015/01/16 15:12:56 Done.
+ if (va_res != VA_STATUS_SUCCESS)
+ return false;
+
+ va_res = vaGetImage(va_display_, va_surface_id, 0, 0, size.width(),
+ size.height(), image->image_id);
+ VA_LOG_ON_ERROR(va_res, "vaDeriveImage failed");
wuchengli 2015/01/12 09:08:53 s/vaDeriveImage/vaGetImage/ and VA_SUCCESS_OR_RETU
kcwu 2015/01/16 15:12:56 Done.
+ if (va_res != VA_STATUS_SUCCESS)
Owen Lin 2015/01/13 06:17:59 free the resource of image (since it has been crea
kcwu 2015/01/16 15:12:56 Done.
+ return false;
+
+ // Map the VAImage into memory
+ va_res = vaMapBuffer(va_display_, image->buf, mem);
+ VA_LOG_ON_ERROR(va_res, "vaMapBuffer failed");
+ if (va_res == VA_STATUS_SUCCESS)
+ return true;
+
+ va_res = vaDestroyImage(va_display_, image->image_id);
+ VA_LOG_ON_ERROR(va_res, "vaDestroyImage failed");
+
+ return false;
wuchengli 2015/01/12 09:08:53 It's easier to understand to return true at the en
Owen Lin 2015/01/13 06:17:59 +1
kcwu 2015/01/16 15:12:56 Since I need to call vaDestroyImage for failed cas
+}
+
void VaapiWrapper::ReturnVaImageForTesting(VAImage* image) {
base::AutoLock auto_lock(va_lock_);

Powered by Google App Engine
This is Rietveld 408576698