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

Side by Side Diff: media/gpu/v4l2_jpeg_decode_accelerator.cc

Issue 1973753003: media/gpu: restore some of the reformatting done during migration to media/gpu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/gpu/v4l2_image_processor.cc ('k') | media/gpu/v4l2_slice_video_decode_accelerator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/gpu/v4l2_jpeg_decode_accelerator.h" 5 #include "media/gpu/v4l2_jpeg_decode_accelerator.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 561
562 EnqueueInput(); 562 EnqueueInput();
563 EnqueueOutput(); 563 EnqueueOutput();
564 564
565 if (!running_jobs_.empty()) { 565 if (!running_jobs_.empty()) {
566 device_poll_task_runner_->PostTask( 566 device_poll_task_runner_->PostTask(
567 FROM_HERE, base::Bind(&V4L2JpegDecodeAccelerator::DevicePollTask, 567 FROM_HERE, base::Bind(&V4L2JpegDecodeAccelerator::DevicePollTask,
568 base::Unretained(this))); 568 base::Unretained(this)));
569 } 569 }
570 570
571 DVLOG(2) << __func__ << ": buffer counts: INPUT[" << input_jobs_.size() 571 DVLOG(2) << __func__ << ": buffer counts: INPUT["
572 << "] => DEVICE[" << free_input_buffers_.size() << "/" 572 << input_jobs_.size() << "] => DEVICE["
573 << input_buffer_map_.size() << "->" << free_output_buffers_.size() 573 << free_input_buffers_.size() << "/"
574 << "/" << output_buffer_map_.size() << "]"; 574 << input_buffer_map_.size() << "->"
575 << free_output_buffers_.size() << "/"
576 << output_buffer_map_.size() << "]";
575 } 577 }
576 578
577 void V4L2JpegDecodeAccelerator::EnqueueInput() { 579 void V4L2JpegDecodeAccelerator::EnqueueInput() {
578 DCHECK(decoder_task_runner_->BelongsToCurrentThread()); 580 DCHECK(decoder_task_runner_->BelongsToCurrentThread());
579 while (!input_jobs_.empty() && !free_input_buffers_.empty()) { 581 while (!input_jobs_.empty() && !free_input_buffers_.empty()) {
580 // If input buffers are required to re-create, do not enqueue input record 582 // If input buffers are required to re-create, do not enqueue input record
581 // until all pending frames are handled by device. 583 // until all pending frames are handled by device.
582 if (ShouldRecreateInputBuffers()) 584 if (ShouldRecreateInputBuffers())
583 break; 585 break;
584 if (!EnqueueInputRecord()) 586 if (!EnqueueInputRecord())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 V4L2Device::V4L2PixFmtToVideoPixelFormat(src_pixelformat); 621 V4L2Device::V4L2PixFmtToVideoPixelFormat(src_pixelformat);
620 size_t src_size = media::VideoFrame::AllocationSize(format, src_coded_size); 622 size_t src_size = media::VideoFrame::AllocationSize(format, src_coded_size);
621 uint8_t* dst_y = dst_frame->data(media::VideoFrame::kYPlane); 623 uint8_t* dst_y = dst_frame->data(media::VideoFrame::kYPlane);
622 uint8_t* dst_u = dst_frame->data(media::VideoFrame::kUPlane); 624 uint8_t* dst_u = dst_frame->data(media::VideoFrame::kUPlane);
623 uint8_t* dst_v = dst_frame->data(media::VideoFrame::kVPlane); 625 uint8_t* dst_v = dst_frame->data(media::VideoFrame::kVPlane);
624 size_t dst_y_stride = dst_frame->stride(media::VideoFrame::kYPlane); 626 size_t dst_y_stride = dst_frame->stride(media::VideoFrame::kYPlane);
625 size_t dst_u_stride = dst_frame->stride(media::VideoFrame::kUPlane); 627 size_t dst_u_stride = dst_frame->stride(media::VideoFrame::kUPlane);
626 size_t dst_v_stride = dst_frame->stride(media::VideoFrame::kVPlane); 628 size_t dst_v_stride = dst_frame->stride(media::VideoFrame::kVPlane);
627 629
628 // If the source format is I420, ConvertToI420 will simply copy the frame. 630 // If the source format is I420, ConvertToI420 will simply copy the frame.
629 if (libyuv::ConvertToI420( 631 if (libyuv::ConvertToI420(static_cast<uint8_t*>(const_cast<void*>(src_addr)),
630 static_cast<uint8_t*>(const_cast<void*>(src_addr)), src_size, dst_y, 632 src_size,
631 dst_y_stride, dst_u, dst_u_stride, dst_v, dst_v_stride, 0, 0, 633 dst_y, dst_y_stride,
632 src_coded_size.width(), src_coded_size.height(), 634 dst_u, dst_u_stride,
633 dst_frame->coded_size().width(), dst_frame->coded_size().height(), 635 dst_v, dst_v_stride,
634 libyuv::kRotate0, src_pixelformat)) { 636 0, 0,
637 src_coded_size.width(),
638 src_coded_size.height(),
639 dst_frame->coded_size().width(),
640 dst_frame->coded_size().height(),
641 libyuv::kRotate0,
642 src_pixelformat)) {
635 LOG(ERROR) << "ConvertToI420 failed. Source format: " << src_pixelformat; 643 LOG(ERROR) << "ConvertToI420 failed. Source format: " << src_pixelformat;
636 return false; 644 return false;
637 } 645 }
638 return true; 646 return true;
639 } 647 }
640 648
641 void V4L2JpegDecodeAccelerator::Dequeue() { 649 void V4L2JpegDecodeAccelerator::Dequeue() {
642 DCHECK(decoder_task_runner_->BelongsToCurrentThread()); 650 DCHECK(decoder_task_runner_->BelongsToCurrentThread());
643 651
644 // Dequeue completed input (VIDEO_OUTPUT) buffers, 652 // Dequeue completed input (VIDEO_OUTPUT) buffers,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 device_poll_thread_.Stop(); 890 device_poll_thread_.Stop();
883 891
884 // Clear the interrupt now, to be sure. 892 // Clear the interrupt now, to be sure.
885 if (!device_->ClearDevicePollInterrupt()) 893 if (!device_->ClearDevicePollInterrupt())
886 return false; 894 return false;
887 895
888 return true; 896 return true;
889 } 897 }
890 898
891 } // namespace media 899 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/v4l2_image_processor.cc ('k') | media/gpu/v4l2_slice_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698