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

Side by Side Diff: content/common/gpu/media/exynos_video_encode_accelerator.cc

Issue 24667002: EVEA H.264: Disable periodic key frames by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable periodic key frames altogether, as suggested by sheu. Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/common/gpu/media/exynos_video_encode_accelerator.h" 5 #include "content/common/gpu/media/exynos_video_encode_accelerator.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <sys/eventfd.h> 10 #include <sys/eventfd.h>
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 format.fmt.pix_mp.height = output_visible_size_.height(); 1357 format.fmt.pix_mp.height = output_visible_size_.height();
1358 format.fmt.pix_mp.pixelformat = output_format_fourcc_; 1358 format.fmt.pix_mp.pixelformat = output_format_fourcc_;
1359 format.fmt.pix_mp.plane_fmt[0].sizeimage = output_buffer_byte_size_; 1359 format.fmt.pix_mp.plane_fmt[0].sizeimage = output_buffer_byte_size_;
1360 format.fmt.pix_mp.num_planes = 1; 1360 format.fmt.pix_mp.num_planes = 1;
1361 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_S_FMT, &format); 1361 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_S_FMT, &format);
1362 1362
1363 return true; 1363 return true;
1364 } 1364 }
1365 1365
1366 bool ExynosVideoEncodeAccelerator::InitMfcControls() { 1366 bool ExynosVideoEncodeAccelerator::InitMfcControls() {
1367 struct v4l2_ext_control ctrls[8]; 1367 struct v4l2_ext_control ctrls[9];
1368 struct v4l2_ext_controls control; 1368 struct v4l2_ext_controls control;
1369 memset(&ctrls, 0, sizeof(ctrls)); 1369 memset(&ctrls, 0, sizeof(ctrls));
1370 memset(&control, 0, sizeof(control)); 1370 memset(&control, 0, sizeof(control));
1371 // No B-frames, for lowest decoding latency. 1371 // No B-frames, for lowest decoding latency.
1372 ctrls[0].id = V4L2_CID_MPEG_VIDEO_B_FRAMES; 1372 ctrls[0].id = V4L2_CID_MPEG_VIDEO_B_FRAMES;
1373 ctrls[0].value = 0; 1373 ctrls[0].value = 0;
1374 // Enable frame-level bitrate control. 1374 // Enable frame-level bitrate control.
1375 ctrls[1].id = V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE; 1375 ctrls[1].id = V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE;
1376 ctrls[1].value = 1; 1376 ctrls[1].value = 1;
1377 // Enable "tight" bitrate mode. For this to work properly, frame- and mb-level 1377 // Enable "tight" bitrate mode. For this to work properly, frame- and mb-level
1378 // bitrate controls have to be enabled as well. 1378 // bitrate controls have to be enabled as well.
1379 ctrls[2].id = V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF; 1379 ctrls[2].id = V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF;
1380 ctrls[2].value = 1; 1380 ctrls[2].value = 1;
1381 // Force bitrate control to average over a GOP (for tight bitrate 1381 // Force bitrate control to average over a GOP (for tight bitrate
1382 // tolerance). 1382 // tolerance).
1383 ctrls[3].id = V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT; 1383 ctrls[3].id = V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT;
1384 ctrls[3].value = 1; 1384 ctrls[3].value = 1;
1385 // Quantization parameter maximum value (for variable bitrate control). 1385 // Quantization parameter maximum value (for variable bitrate control).
1386 ctrls[4].id = V4L2_CID_MPEG_VIDEO_H264_MAX_QP; 1386 ctrls[4].id = V4L2_CID_MPEG_VIDEO_H264_MAX_QP;
1387 ctrls[4].value = 51; 1387 ctrls[4].value = 51;
1388 // Separate stream header so we can cache it and insert into the stream. 1388 // Separate stream header so we can cache it and insert into the stream.
1389 ctrls[5].id = V4L2_CID_MPEG_VIDEO_HEADER_MODE; 1389 ctrls[5].id = V4L2_CID_MPEG_VIDEO_HEADER_MODE;
1390 ctrls[5].value = V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE; 1390 ctrls[5].value = V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE;
1391 // Enable macroblock-level bitrate control. 1391 // Enable macroblock-level bitrate control.
1392 ctrls[6].id = V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE; 1392 ctrls[6].id = V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE;
1393 ctrls[6].value = 1; 1393 ctrls[6].value = 1;
1394 // Use H.264 level 4.0 to match the supported max resolution. 1394 // Use H.264 level 4.0 to match the supported max resolution.
1395 ctrls[7].id = V4L2_CID_MPEG_VIDEO_H264_LEVEL; 1395 ctrls[7].id = V4L2_CID_MPEG_VIDEO_H264_LEVEL;
1396 ctrls[7].value = V4L2_MPEG_VIDEO_H264_LEVEL_4_0; 1396 ctrls[7].value = V4L2_MPEG_VIDEO_H264_LEVEL_4_0;
1397 // Disable periodic key frames.
1398 ctrls[8].id = V4L2_CID_MPEG_VIDEO_GOP_SIZE;
1399 ctrls[8].value = 0;
1397 control.ctrl_class = V4L2_CTRL_CLASS_MPEG; 1400 control.ctrl_class = V4L2_CTRL_CLASS_MPEG;
1398 control.count = arraysize(ctrls); 1401 control.count = arraysize(ctrls);
1399 control.controls = ctrls; 1402 control.controls = ctrls;
1400 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_S_EXT_CTRLS, &control); 1403 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_S_EXT_CTRLS, &control);
1401 1404
1402 return true; 1405 return true;
1403 } 1406 }
1404 1407
1405 bool ExynosVideoEncodeAccelerator::CreateMfcInputBuffers() { 1408 bool ExynosVideoEncodeAccelerator::CreateMfcInputBuffers() {
1406 DVLOG(3) << "CreateMfcInputBuffers()"; 1409 DVLOG(3) << "CreateMfcInputBuffers()";
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1556 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
1554 reqbufs.memory = V4L2_MEMORY_MMAP; 1557 reqbufs.memory = V4L2_MEMORY_MMAP;
1555 if (HANDLE_EINTR(ioctl(mfc_fd_, VIDIOC_REQBUFS, &reqbufs)) != 0) 1558 if (HANDLE_EINTR(ioctl(mfc_fd_, VIDIOC_REQBUFS, &reqbufs)) != 0)
1556 DPLOG(ERROR) << "DestroyMfcOutputBuffers(): ioctl() failed: VIDIOC_REQBUFS"; 1559 DPLOG(ERROR) << "DestroyMfcOutputBuffers(): ioctl() failed: VIDIOC_REQBUFS";
1557 1560
1558 mfc_output_buffer_map_.clear(); 1561 mfc_output_buffer_map_.clear();
1559 mfc_free_output_buffers_.clear(); 1562 mfc_free_output_buffers_.clear();
1560 } 1563 }
1561 1564
1562 } // namespace content 1565 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698