1 /**************************************************************************
2 *
3 * Copyright 2013 Advanced Micro Devices, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #include "pipe/p_video_codec.h"
29 #include "radeon_vce.h"
30 #include "radeon_video.h"
31 #include "si_pipe.h"
32 #include "util/u_memory.h"
33 #include "util/u_video.h"
34 #include "vl/vl_video_buffer.h"
35
36 #include <stdio.h>
37
session(struct rvce_encoder * enc)38 static void session(struct rvce_encoder *enc)
39 {
40 RVCE_BEGIN(0x00000001); // session cmd
41 RVCE_CS(enc->stream_handle);
42 RVCE_END();
43 }
44
task_info(struct rvce_encoder * enc,uint32_t op,uint32_t dep,uint32_t fb_idx,uint32_t ring_idx)45 static void task_info(struct rvce_encoder *enc, uint32_t op, uint32_t dep, uint32_t fb_idx,
46 uint32_t ring_idx)
47 {
48 RVCE_BEGIN(0x00000002); // task info
49 if (op == 0x3) {
50 if (enc->task_info_idx) {
51 uint32_t offs = enc->cs->current.cdw - enc->task_info_idx + 3;
52 // Update offsetOfNextTaskInfo
53 enc->cs->current.buf[enc->task_info_idx] = offs;
54 }
55 enc->task_info_idx = enc->cs->current.cdw;
56 }
57 RVCE_CS(0xffffffff); // offsetOfNextTaskInfo
58 RVCE_CS(op); // taskOperation
59 RVCE_CS(dep); // referencePictureDependency
60 RVCE_CS(0x00000000); // collocateFlagDependency
61 RVCE_CS(fb_idx); // feedbackIndex
62 RVCE_CS(ring_idx); // videoBitstreamRingIndex
63 RVCE_END();
64 }
65
feedback(struct rvce_encoder * enc)66 static void feedback(struct rvce_encoder *enc)
67 {
68 RVCE_BEGIN(0x05000005); // feedback buffer
69 RVCE_WRITE(enc->fb->res->buf, enc->fb->res->domains, 0x0); // feedbackRingAddressHi/Lo
70 RVCE_CS(0x00000001); // feedbackRingSize
71 RVCE_END();
72 }
73
create(struct rvce_encoder * enc)74 static void create(struct rvce_encoder *enc)
75 {
76 enc->task_info(enc, 0x00000000, 0, 0, 0);
77
78 RVCE_BEGIN(0x01000001); // create cmd
79 RVCE_CS(0x00000000); // encUseCircularBuffer
80 RVCE_CS(u_get_h264_profile_idc(enc->base.profile)); // encProfile
81 RVCE_CS(enc->base.level); // encLevel
82 RVCE_CS(0x00000000); // encPicStructRestriction
83 RVCE_CS(enc->base.width); // encImageWidth
84 RVCE_CS(enc->base.height); // encImageHeight
85 RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe); // encRefPicLumaPitch
86 RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encRefPicChromaPitch
87 RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16) / 8); // encRefYHeightInQw
88 RVCE_CS(0x00000000); // encRefPic(Addr|Array)Mode, encPicStructRestriction, disableRDO
89 RVCE_END();
90 }
91
rate_control(struct rvce_encoder * enc)92 static void rate_control(struct rvce_encoder *enc)
93 {
94 RVCE_BEGIN(0x04000005); // rate control
95 RVCE_CS(enc->pic.rate_ctrl.rate_ctrl_method); // encRateControlMethod
96 RVCE_CS(enc->pic.rate_ctrl.target_bitrate); // encRateControlTargetBitRate
97 RVCE_CS(enc->pic.rate_ctrl.peak_bitrate); // encRateControlPeakBitRate
98 RVCE_CS(enc->pic.rate_ctrl.frame_rate_num); // encRateControlFrameRateNum
99 RVCE_CS(0x00000000); // encGOPSize
100 RVCE_CS(enc->pic.quant_i_frames); // encQP_I
101 RVCE_CS(enc->pic.quant_p_frames); // encQP_P
102 RVCE_CS(enc->pic.quant_b_frames); // encQP_B
103 RVCE_CS(enc->pic.rate_ctrl.vbv_buffer_size); // encVBVBufferSize
104 RVCE_CS(enc->pic.rate_ctrl.frame_rate_den); // encRateControlFrameRateDen
105 RVCE_CS(0x00000000); // encVBVBufferLevel
106 RVCE_CS(0x00000000); // encMaxAUSize
107 RVCE_CS(0x00000000); // encQPInitialMode
108 RVCE_CS(enc->pic.rate_ctrl.target_bits_picture); // encTargetBitsPerPicture
109 RVCE_CS(enc->pic.rate_ctrl.peak_bits_picture_integer); // encPeakBitsPerPictureInteger
110 RVCE_CS(enc->pic.rate_ctrl.peak_bits_picture_fraction); // encPeakBitsPerPictureFractional
111 RVCE_CS(0x00000000); // encMinQP
112 RVCE_CS(0x00000033); // encMaxQP
113 RVCE_CS(0x00000000); // encSkipFrameEnable
114 RVCE_CS(0x00000000); // encFillerDataEnable
115 RVCE_CS(0x00000000); // encEnforceHRD
116 RVCE_CS(0x00000000); // encBPicsDeltaQP
117 RVCE_CS(0x00000000); // encReferenceBPicsDeltaQP
118 RVCE_CS(0x00000000); // encRateControlReInitDisable
119 RVCE_END();
120 }
121
config_extension(struct rvce_encoder * enc)122 static void config_extension(struct rvce_encoder *enc)
123 {
124 RVCE_BEGIN(0x04000001); // config extension
125 RVCE_CS(0x00000003); // encEnablePerfLogging
126 RVCE_END();
127 }
128
pic_control(struct rvce_encoder * enc)129 static void pic_control(struct rvce_encoder *enc)
130 {
131 unsigned encNumMBsPerSlice;
132
133 encNumMBsPerSlice = align(enc->base.width, 16) / 16;
134 encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
135
136 RVCE_BEGIN(0x04000002); // pic control
137 RVCE_CS(0x00000000); // encUseConstrainedIntraPred
138 RVCE_CS(0x00000000); // encCABACEnable
139 RVCE_CS(0x00000000); // encCABACIDC
140 RVCE_CS(0x00000000); // encLoopFilterDisable
141 RVCE_CS(0x00000000); // encLFBetaOffset
142 RVCE_CS(0x00000000); // encLFAlphaC0Offset
143 RVCE_CS(0x00000000); // encCropLeftOffset
144 RVCE_CS((align(enc->base.width, 16) - enc->base.width) >> 1); // encCropRightOffset
145 RVCE_CS(0x00000000); // encCropTopOffset
146 RVCE_CS((align(enc->base.height, 16) - enc->base.height) >> 1); // encCropBottomOffset
147 RVCE_CS(encNumMBsPerSlice); // encNumMBsPerSlice
148 RVCE_CS(0x00000000); // encIntraRefreshNumMBsPerSlot
149 RVCE_CS(0x00000000); // encForceIntraRefresh
150 RVCE_CS(0x00000000); // encForceIMBPeriod
151 RVCE_CS(0x00000000); // encPicOrderCntType
152 RVCE_CS(0x00000000); // log2_max_pic_order_cnt_lsb_minus4
153 RVCE_CS(0x00000000); // encSPSID
154 RVCE_CS(0x00000000); // encPPSID
155 RVCE_CS(0x00000040); // encConstraintSetFlags
156 RVCE_CS(MAX2(enc->base.max_references, 1) - 1); // encBPicPattern
157 RVCE_CS(0x00000000); // weightPredModeBPicture
158 RVCE_CS(MIN2(enc->base.max_references, 2)); // encNumberOfReferenceFrames
159 RVCE_CS(enc->base.max_references + 1); // encMaxNumRefFrames
160 RVCE_CS(0x00000001); // encNumDefaultActiveRefL0
161 RVCE_CS(0x00000001); // encNumDefaultActiveRefL1
162 RVCE_CS(0x00000000); // encSliceMode
163 RVCE_CS(0x00000000); // encMaxSliceSize
164 RVCE_END();
165 }
166
motion_estimation(struct rvce_encoder * enc)167 static void motion_estimation(struct rvce_encoder *enc)
168 {
169 RVCE_BEGIN(0x04000007); // motion estimation
170 RVCE_CS(0x00000001); // encIMEDecimationSearch
171 RVCE_CS(0x00000001); // motionEstHalfPixel
172 RVCE_CS(0x00000000); // motionEstQuarterPixel
173 RVCE_CS(0x00000000); // disableFavorPMVPoint
174 RVCE_CS(0x00000000); // forceZeroPointCenter
175 RVCE_CS(0x00000000); // LSMVert
176 RVCE_CS(0x00000010); // encSearchRangeX
177 RVCE_CS(0x00000010); // encSearchRangeY
178 RVCE_CS(0x00000010); // encSearch1RangeX
179 RVCE_CS(0x00000010); // encSearch1RangeY
180 RVCE_CS(0x00000000); // disable16x16Frame1
181 RVCE_CS(0x00000000); // disableSATD
182 RVCE_CS(0x00000000); // enableAMD
183 RVCE_CS(0x000000fe); // encDisableSubMode
184 RVCE_CS(0x00000000); // encIMESkipX
185 RVCE_CS(0x00000000); // encIMESkipY
186 RVCE_CS(0x00000000); // encEnImeOverwDisSubm
187 RVCE_CS(0x00000000); // encImeOverwDisSubmNo
188 RVCE_CS(0x00000001); // encIME2SearchRangeX
189 RVCE_CS(0x00000001); // encIME2SearchRangeY
190 RVCE_CS(0x00000000); // parallelModeSpeedupEnable
191 RVCE_CS(0x00000000); // fme0_encDisableSubMode
192 RVCE_CS(0x00000000); // fme1_encDisableSubMode
193 RVCE_CS(0x00000000); // imeSWSpeedupEnable
194 RVCE_END();
195 }
196
rdo(struct rvce_encoder * enc)197 static void rdo(struct rvce_encoder *enc)
198 {
199 RVCE_BEGIN(0x04000008); // rdo
200 RVCE_CS(0x00000000); // encDisableTbePredIFrame
201 RVCE_CS(0x00000000); // encDisableTbePredPFrame
202 RVCE_CS(0x00000000); // useFmeInterpolY
203 RVCE_CS(0x00000000); // useFmeInterpolUV
204 RVCE_CS(0x00000000); // useFmeIntrapolY
205 RVCE_CS(0x00000000); // useFmeIntrapolUV
206 RVCE_CS(0x00000000); // useFmeInterpolY_1
207 RVCE_CS(0x00000000); // useFmeInterpolUV_1
208 RVCE_CS(0x00000000); // useFmeIntrapolY_1
209 RVCE_CS(0x00000000); // useFmeIntrapolUV_1
210 RVCE_CS(0x00000000); // enc16x16CostAdj
211 RVCE_CS(0x00000000); // encSkipCostAdj
212 RVCE_CS(0x00000000); // encForce16x16skip
213 RVCE_CS(0x00000000); // encDisableThresholdCalcA
214 RVCE_CS(0x00000000); // encLumaCoeffCost
215 RVCE_CS(0x00000000); // encLumaMBCoeffCost
216 RVCE_CS(0x00000000); // encChromaCoeffCost
217 RVCE_END();
218 }
219
vui(struct rvce_encoder * enc)220 static void vui(struct rvce_encoder *enc)
221 {
222 int i;
223
224 if (!enc->pic.rate_ctrl.frame_rate_num)
225 return;
226
227 RVCE_BEGIN(0x04000009); // vui
228 RVCE_CS(0x00000000); // aspectRatioInfoPresentFlag
229 RVCE_CS(0x00000000); // aspectRatioInfo.aspectRatioIdc
230 RVCE_CS(0x00000000); // aspectRatioInfo.sarWidth
231 RVCE_CS(0x00000000); // aspectRatioInfo.sarHeight
232 RVCE_CS(0x00000000); // overscanInfoPresentFlag
233 RVCE_CS(0x00000000); // overScanInfo.overscanAppropFlag
234 RVCE_CS(0x00000000); // videoSignalTypePresentFlag
235 RVCE_CS(0x00000005); // videoSignalTypeInfo.videoFormat
236 RVCE_CS(0x00000000); // videoSignalTypeInfo.videoFullRangeFlag
237 RVCE_CS(0x00000000); // videoSignalTypeInfo.colorDescriptionPresentFlag
238 RVCE_CS(0x00000002); // videoSignalTypeInfo.colorPrim
239 RVCE_CS(0x00000002); // videoSignalTypeInfo.transferChar
240 RVCE_CS(0x00000002); // videoSignalTypeInfo.matrixCoef
241 RVCE_CS(0x00000000); // chromaLocInfoPresentFlag
242 RVCE_CS(0x00000000); // chromaLocInfo.chromaLocTop
243 RVCE_CS(0x00000000); // chromaLocInfo.chromaLocBottom
244 RVCE_CS(0x00000001); // timingInfoPresentFlag
245 RVCE_CS(enc->pic.rate_ctrl.frame_rate_den); // timingInfo.numUnitsInTick
246 RVCE_CS(enc->pic.rate_ctrl.frame_rate_num * 2); // timingInfo.timeScale;
247 RVCE_CS(0x00000001); // timingInfo.fixedFrameRateFlag
248 RVCE_CS(0x00000000); // nalHRDParametersPresentFlag
249 RVCE_CS(0x00000000); // hrdParam.cpbCntMinus1
250 RVCE_CS(0x00000004); // hrdParam.bitRateScale
251 RVCE_CS(0x00000006); // hrdParam.cpbSizeScale
252 for (i = 0; i < 32; i++) {
253 RVCE_CS(0x00000000); // hrdParam.bitRateValueMinus
254 RVCE_CS(0x00000000); // hrdParam.cpbSizeValueMinus
255 RVCE_CS(0x00000000); // hrdParam.cbrFlag
256 }
257 RVCE_CS(0x00000017); // hrdParam.initialCpbRemovalDelayLengthMinus1
258 RVCE_CS(0x00000017); // hrdParam.cpbRemovalDelayLengthMinus1
259 RVCE_CS(0x00000017); // hrdParam.dpbOutputDelayLengthMinus1
260 RVCE_CS(0x00000018); // hrdParam.timeOffsetLength
261 RVCE_CS(0x00000000); // lowDelayHRDFlag
262 RVCE_CS(0x00000000); // picStructPresentFlag
263 RVCE_CS(0x00000000); // bitstreamRestrictionPresentFlag
264 RVCE_CS(0x00000001); // bitstreamRestrictions.motionVectorsOverPicBoundariesFlag
265 RVCE_CS(0x00000002); // bitstreamRestrictions.maxBytesPerPicDenom
266 RVCE_CS(0x00000001); // bitstreamRestrictions.maxBitsPerMbDenom
267 RVCE_CS(0x00000010); // bitstreamRestrictions.log2MaxMvLengthHori
268 RVCE_CS(0x00000010); // bitstreamRestrictions.log2MaxMvLengthVert
269 RVCE_CS(0x00000003); // bitstreamRestrictions.numReorderFrames
270 RVCE_CS(0x00000003); // bitstreamRestrictions.maxDecFrameBuffering
271 RVCE_END();
272 }
273
config(struct rvce_encoder * enc)274 static void config(struct rvce_encoder *enc)
275 {
276 enc->task_info(enc, 0x00000002, 0, 0xffffffff, 0);
277 enc->rate_control(enc);
278 enc->config_extension(enc);
279 enc->motion_estimation(enc);
280 enc->rdo(enc);
281 if (enc->use_vui)
282 enc->vui(enc);
283 enc->pic_control(enc);
284 }
285
encode(struct rvce_encoder * enc)286 static void encode(struct rvce_encoder *enc)
287 {
288 signed luma_offset, chroma_offset;
289 int i;
290
291 enc->task_info(enc, 0x00000003, 0, 0, 0);
292
293 RVCE_BEGIN(0x05000001); // context buffer
294 RVCE_READWRITE(enc->cpb.res->buf, enc->cpb.res->domains, 0x0); // encodeContextAddressHi/Lo
295 RVCE_END();
296
297 RVCE_BEGIN(0x05000004); // video bitstream buffer
298 RVCE_WRITE(enc->bs_handle, RADEON_DOMAIN_GTT, 0x0); // videoBitstreamRingAddressHi/Lo
299 RVCE_CS(enc->bs_size); // videoBitstreamRingSize
300 RVCE_END();
301
302 RVCE_BEGIN(0x03000001); // encode
303 RVCE_CS(0x00000000); // insertHeaders
304 RVCE_CS(0x00000000); // pictureStructure
305 RVCE_CS(enc->bs_size); // allowedMaxBitstreamSize
306 RVCE_CS(0x00000000); // forceRefreshMap
307 RVCE_CS(0x00000000); // insertAUD
308 RVCE_CS(0x00000000); // endOfSequence
309 RVCE_CS(0x00000000); // endOfStream
310 RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
311 enc->luma->u.legacy.level[0].offset); // inputPictureLumaAddressHi/Lo
312 RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
313 enc->chroma->u.legacy.level[0].offset); // inputPictureChromaAddressHi/Lo
314 RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16)); // encInputFrameYPitch
315 RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe); // encInputPicLumaPitch
316 RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encInputPicChromaPitch
317 RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode
318 RVCE_CS(0x00000000); // encInputPicTileConfig
319 RVCE_CS(enc->pic.picture_type); // encPicType
320 RVCE_CS(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR); // encIdrFlag
321 RVCE_CS(0x00000000); // encIdrPicId
322 RVCE_CS(0x00000000); // encMGSKeyPic
323 RVCE_CS(!enc->pic.not_referenced); // encReferenceFlag
324 RVCE_CS(0x00000000); // encTemporalLayerIndex
325 RVCE_CS(0x00000000); // num_ref_idx_active_override_flag
326 RVCE_CS(0x00000000); // num_ref_idx_l0_active_minus1
327 RVCE_CS(0x00000000); // num_ref_idx_l1_active_minus1
328
329 i = enc->pic.frame_num - enc->pic.ref_idx_l0;
330 if (i > 1 && enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_P) {
331 RVCE_CS(0x00000001); // encRefListModificationOp
332 RVCE_CS(i - 1); // encRefListModificationNum
333 } else {
334 RVCE_CS(0x00000000); // encRefListModificationOp
335 RVCE_CS(0x00000000); // encRefListModificationNum
336 }
337
338 for (i = 0; i < 3; ++i) {
339 RVCE_CS(0x00000000); // encRefListModificationOp
340 RVCE_CS(0x00000000); // encRefListModificationNum
341 }
342 for (i = 0; i < 4; ++i) {
343 RVCE_CS(0x00000000); // encDecodedPictureMarkingOp
344 RVCE_CS(0x00000000); // encDecodedPictureMarkingNum
345 RVCE_CS(0x00000000); // encDecodedPictureMarkingIdx
346 RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingOp
347 RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingNum
348 }
349
350 // encReferencePictureL0[0]
351 RVCE_CS(0x00000000); // pictureStructure
352 if (enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_P ||
353 enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_B) {
354 struct rvce_cpb_slot *l0 = si_l0_slot(enc);
355 si_vce_frame_offset(enc, l0, &luma_offset, &chroma_offset);
356 RVCE_CS(l0->picture_type); // encPicType
357 RVCE_CS(l0->frame_num); // frameNumber
358 RVCE_CS(l0->pic_order_cnt); // pictureOrderCount
359 RVCE_CS(luma_offset); // lumaOffset
360 RVCE_CS(chroma_offset); // chromaOffset
361 } else {
362 RVCE_CS(0x00000000); // encPicType
363 RVCE_CS(0x00000000); // frameNumber
364 RVCE_CS(0x00000000); // pictureOrderCount
365 RVCE_CS(0xffffffff); // lumaOffset
366 RVCE_CS(0xffffffff); // chromaOffset
367 }
368
369 // encReferencePictureL0[1]
370 RVCE_CS(0x00000000); // pictureStructure
371 RVCE_CS(0x00000000); // encPicType
372 RVCE_CS(0x00000000); // frameNumber
373 RVCE_CS(0x00000000); // pictureOrderCount
374 RVCE_CS(0xffffffff); // lumaOffset
375 RVCE_CS(0xffffffff); // chromaOffset
376
377 // encReferencePictureL1[0]
378 RVCE_CS(0x00000000); // pictureStructure
379 if (enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_B) {
380 struct rvce_cpb_slot *l1 = si_l1_slot(enc);
381 si_vce_frame_offset(enc, l1, &luma_offset, &chroma_offset);
382 RVCE_CS(l1->picture_type); // encPicType
383 RVCE_CS(l1->frame_num); // frameNumber
384 RVCE_CS(l1->pic_order_cnt); // pictureOrderCount
385 RVCE_CS(luma_offset); // lumaOffset
386 RVCE_CS(chroma_offset); // chromaOffset
387 } else {
388 RVCE_CS(0x00000000); // encPicType
389 RVCE_CS(0x00000000); // frameNumber
390 RVCE_CS(0x00000000); // pictureOrderCount
391 RVCE_CS(0xffffffff); // lumaOffset
392 RVCE_CS(0xffffffff); // chromaOffset
393 }
394
395 si_vce_frame_offset(enc, si_current_slot(enc), &luma_offset, &chroma_offset);
396 RVCE_CS(luma_offset); // encReconstructedLumaOffset
397 RVCE_CS(chroma_offset); // encReconstructedChromaOffset
398 RVCE_CS(0x00000000); // encColocBufferOffset
399 RVCE_CS(0x00000000); // encReconstructedRefBasePictureLumaOffset
400 RVCE_CS(0x00000000); // encReconstructedRefBasePictureChromaOffset
401 RVCE_CS(0x00000000); // encReferenceRefBasePictureLumaOffset
402 RVCE_CS(0x00000000); // encReferenceRefBasePictureChromaOffset
403 RVCE_CS(0x00000000); // pictureCount
404 RVCE_CS(enc->pic.frame_num); // frameNumber
405 RVCE_CS(enc->pic.pic_order_cnt); // pictureOrderCount
406 RVCE_CS(0x00000000); // numIPicRemainInRCGOP
407 RVCE_CS(0x00000000); // numPPicRemainInRCGOP
408 RVCE_CS(0x00000000); // numBPicRemainInRCGOP
409 RVCE_CS(0x00000000); // numIRPicRemainInRCGOP
410 RVCE_CS(0x00000000); // enableIntraRefresh
411 RVCE_END();
412 }
413
destroy(struct rvce_encoder * enc)414 static void destroy(struct rvce_encoder *enc)
415 {
416 enc->task_info(enc, 0x00000001, 0, 0, 0);
417
418 feedback(enc);
419
420 RVCE_BEGIN(0x02000001); // destroy
421 RVCE_END();
422 }
423
si_vce_40_2_2_get_param(struct rvce_encoder * enc,struct pipe_h264_enc_picture_desc * pic)424 void si_vce_40_2_2_get_param(struct rvce_encoder *enc, struct pipe_h264_enc_picture_desc *pic)
425 {
426 }
427
si_vce_40_2_2_init(struct rvce_encoder * enc)428 void si_vce_40_2_2_init(struct rvce_encoder *enc)
429 {
430 enc->session = session;
431 enc->task_info = task_info;
432 enc->create = create;
433 enc->feedback = feedback;
434 enc->rate_control = rate_control;
435 enc->config_extension = config_extension;
436 enc->pic_control = pic_control;
437 enc->motion_estimation = motion_estimation;
438 enc->rdo = rdo;
439 enc->vui = vui;
440 enc->config = config;
441 enc->encode = encode;
442 enc->destroy = destroy;
443 enc->si_get_pic_param = si_vce_40_2_2_get_param;
444 }
445