summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorLeo Liu <leo.liu@amd.com>2014-05-27 10:12:02 -0400
committerChristian König <christian.koenig@amd.com>2014-05-27 16:56:55 +0200
commitb3ad853a2c9d40064b6e8c65ade4b671f1b8d8ad (patch)
treef4f11ba3b63a81d1a37c9f3c23cb421b7c6ef14a /src/gallium
parentcc6c76e8f699a2298c8fe4879a77a698098dd498 (diff)
downloadexternal_mesa3d-b3ad853a2c9d40064b6e8c65ade4b671f1b8d8ad.zip
external_mesa3d-b3ad853a2c9d40064b6e8c65ade4b671f1b8d8ad.tar.gz
external_mesa3d-b3ad853a2c9d40064b6e8c65ade4b671f1b8d8ad.tar.bz2
st/omx/enc: implement restricted b frames pattern
Signed-off-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/omx/vid_enc.c11
-rw-r--r--src/gallium/state_trackers/omx/vid_enc.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/omx/vid_enc.c b/src/gallium/state_trackers/omx/vid_enc.c
index ee31452..e64928b 100644
--- a/src/gallium/state_trackers/omx/vid_enc.c
+++ b/src/gallium/state_trackers/omx/vid_enc.c
@@ -259,6 +259,7 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
priv->force_pic_type.IntraRefreshVOP = OMX_FALSE;
priv->frame_num = 0;
priv->pic_order_cnt = 0;
+ priv->restricted_b_frames = debug_get_bool_option("OMX_USE_RESTRICTED_B_FRAMES", FALSE);
priv->scale.xWidth = OMX_VID_ENC_SCALING_WIDTH_DEFAULT;
priv->scale.xHeight = OMX_VID_ENC_SCALING_WIDTH_DEFAULT;
@@ -994,6 +995,8 @@ static void enc_HandleTask(omx_base_PortType *port, struct encode_task *task,
picture.picture_type = picture_type;
picture.pic_order_cnt = task->pic_order_cnt;
+ if (priv->restricted_b_frames && picture_type == PIPE_H264_ENC_PICTURE_TYPE_B)
+ picture.not_referenced = true;
enc_ControlPicture(port, &picture);
/* -------------- encode frame --------- */
@@ -1023,7 +1026,9 @@ static void enc_ClearBframes(omx_base_PortType *port, struct input_buf_private *
/* handle B frames */
LIST_FOR_EACH_ENTRY(task, &priv->b_frames, list) {
enc_HandleTask(port, task, PIPE_H264_ENC_PICTURE_TYPE_B);
- priv->ref_idx_l0 = priv->frame_num++;
+ if (!priv->restricted_b_frames)
+ priv->ref_idx_l0 = priv->frame_num;
+ priv->frame_num++;
}
enc_MoveTasks(&priv->b_frames, &inp->tasks);
@@ -1091,7 +1096,9 @@ static OMX_ERRORTYPE vid_enc_EncodeFrame(omx_base_PortType *port, OMX_BUFFERHEAD
/* handle B frames */
LIST_FOR_EACH_ENTRY(task, &priv->b_frames, list) {
enc_HandleTask(port, task, PIPE_H264_ENC_PICTURE_TYPE_B);
- priv->ref_idx_l0 = priv->frame_num++;
+ if (!priv->restricted_b_frames)
+ priv->ref_idx_l0 = priv->frame_num;
+ priv->frame_num++;
}
enc_MoveTasks(&priv->b_frames, &inp->tasks);
diff --git a/src/gallium/state_trackers/omx/vid_enc.h b/src/gallium/state_trackers/omx/vid_enc.h
index 22f276f..d0350d6 100644
--- a/src/gallium/state_trackers/omx/vid_enc.h
+++ b/src/gallium/state_trackers/omx/vid_enc.h
@@ -77,6 +77,7 @@ DERIVEDCLASS(vid_enc_PrivateType, omx_base_filter_PrivateType)
OMX_U32 frame_num; \
OMX_U32 pic_order_cnt; \
OMX_U32 ref_idx_l0, ref_idx_l1; \
+ OMX_BOOL restricted_b_frames; \
OMX_VIDEO_PARAM_BITRATETYPE bitrate; \
OMX_VIDEO_PARAM_QUANTIZATIONTYPE quant; \
OMX_CONFIG_INTRAREFRESHVOPTYPE force_pic_type; \