| Index: content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
|
| diff --git a/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc b/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
|
| index 63ed9933358921bf84cca8e962bf7cee8cb7cc07..6d51d27f52636b67b6fec665357fca2dae890bbd 100644
|
| --- a/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
|
| +++ b/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
|
| @@ -28,46 +28,6 @@
|
| UMA_HISTOGRAM_ENUMERATION("Media.VAJDA.DecoderFailure", failure,
|
| VAJDA_DECODER_FAILURES_MAX);
|
| }
|
| -
|
| -static unsigned int VaSurfaceFormatForJpeg(
|
| - const media::JpegFrameHeader& frame_header) {
|
| - // The range of sampling factor is [1, 4]. Pack them into integer to make the
|
| - // matching code simpler. For example, 0x211 means the sampling factor are 2,
|
| - // 1, 1 for 3 components.
|
| - unsigned int h = 0, v = 0;
|
| - for (int i = 0; i < frame_header.num_components; i++) {
|
| - DCHECK_LE(frame_header.components[i].horizontal_sampling_factor, 4);
|
| - DCHECK_LE(frame_header.components[i].vertical_sampling_factor, 4);
|
| - h = h << 4 | frame_header.components[i].horizontal_sampling_factor;
|
| - v = v << 4 | frame_header.components[i].vertical_sampling_factor;
|
| - }
|
| -
|
| - switch (frame_header.num_components) {
|
| - case 1: // Grey image
|
| - return VA_RT_FORMAT_YUV400;
|
| -
|
| - case 3: // Y Cb Cr color image
|
| - // See https://en.wikipedia.org/wiki/Chroma_subsampling for the
|
| - // definition of these numbers.
|
| - if (h == 0x211 && v == 0x211)
|
| - return VA_RT_FORMAT_YUV420;
|
| -
|
| - if (h == 0x211 && v == 0x111)
|
| - return VA_RT_FORMAT_YUV422;
|
| -
|
| - if (h == 0x111 && v == 0x111)
|
| - return VA_RT_FORMAT_YUV444;
|
| -
|
| - if (h == 0x411 && v == 0x111)
|
| - return VA_RT_FORMAT_YUV411;
|
| - }
|
| - DVLOG(1) << "Unsupported sampling factor: num_components="
|
| - << frame_header.num_components << ", h=" << std::hex << h
|
| - << ", v=" << v;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| } // namespace
|
|
|
| VaapiJpegDecodeAccelerator::DecodeRequest::DecodeRequest(
|
| @@ -224,35 +184,25 @@
|
| reinterpret_cast<const uint8_t*>(request->shm->memory()),
|
| request->bitstream_buffer.size(), &parse_result)) {
|
| DLOG(ERROR) << "ParseJpegPicture failed";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| - PARSE_JPEG_FAILED);
|
| - return;
|
| - }
|
| -
|
| - unsigned int new_va_rt_format =
|
| - VaSurfaceFormatForJpeg(parse_result.frame_header);
|
| - if (!new_va_rt_format) {
|
| - DLOG(ERROR) << "Unsupported subsampling";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| - UNSUPPORTED_JPEG);
|
| + NotifyErrorFromDecoderThread(
|
| + request->bitstream_buffer.id(),
|
| + media::JpegDecodeAccelerator::PARSE_JPEG_FAILED);
|
| return;
|
| }
|
|
|
| // Reuse VASurface if size doesn't change.
|
| gfx::Size new_coded_size(parse_result.frame_header.coded_width,
|
| parse_result.frame_header.coded_height);
|
| - if (new_coded_size != coded_size_ || va_surface_id_ == VA_INVALID_SURFACE ||
|
| - new_va_rt_format != va_rt_format_) {
|
| + if (new_coded_size != coded_size_ || va_surface_id_ == VA_INVALID_SURFACE) {
|
| vaapi_wrapper_->DestroySurfaces();
|
| va_surface_id_ = VA_INVALID_SURFACE;
|
| - va_rt_format_ = new_va_rt_format;
|
|
|
| std::vector<VASurfaceID> va_surfaces;
|
| - if (!vaapi_wrapper_->CreateSurfaces(va_rt_format_, new_coded_size, 1,
|
| - &va_surfaces)) {
|
| + if (!vaapi_wrapper_->CreateSurfaces(new_coded_size, 1, &va_surfaces)) {
|
| LOG(ERROR) << "Create VA surface failed";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| - PLATFORM_FAILURE);
|
| + NotifyErrorFromDecoderThread(
|
| + request->bitstream_buffer.id(),
|
| + media::JpegDecodeAccelerator::PLATFORM_FAILURE);
|
| return;
|
| }
|
| va_surface_id_ = va_surfaces[0];
|
| @@ -262,16 +212,18 @@
|
| if (!VaapiJpegDecoder::Decode(vaapi_wrapper_.get(), parse_result,
|
| va_surface_id_)) {
|
| LOG(ERROR) << "Decode JPEG failed";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| - PLATFORM_FAILURE);
|
| + NotifyErrorFromDecoderThread(
|
| + request->bitstream_buffer.id(),
|
| + media::JpegDecodeAccelerator::PLATFORM_FAILURE);
|
| return;
|
| }
|
|
|
| if (!OutputPicture(va_surface_id_, request->bitstream_buffer.id(),
|
| request->video_frame)) {
|
| LOG(ERROR) << "Output picture failed";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| - PLATFORM_FAILURE);
|
| + NotifyErrorFromDecoderThread(
|
| + request->bitstream_buffer.id(),
|
| + media::JpegDecodeAccelerator::PLATFORM_FAILURE);
|
| return;
|
| }
|
| }
|
|
|