MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / rpu_work

Function rpu_work

libhb/rpu.c:196–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194#endif
195
196static int rpu_work(hb_filter_object_t *filter,
197 hb_buffer_t **buf_in,
198 hb_buffer_t **buf_out)
199{
200#if HB_PROJECT_FEATURE_LIBDOVI
201 hb_filter_private_t *pv = filter->private_data;
202 hb_buffer_t *in = *buf_in;
203
204 if (in->s.flags & HB_BUF_FLAG_EOF)
205 {
206 *buf_out = in;
207 *buf_in = NULL;
208 return HB_FILTER_DONE;
209 }
210
211 // libavcodec hevc decoder seems to be missing some rpu
212 // in a specific sample file, work around the issue
213 // by using the last seen rpu
214 apply_rpu_if_needed(pv, in);
215
216 for (int i = 0; i < in->nb_side_data; i++)
217 {
218 const AVFrameSideData *side_data = in->side_data[i];
219 if (side_data->type == AV_FRAME_DATA_DOVI_RPU_BUFFER ||
220 side_data->type == AV_FRAME_DATA_DOVI_RPU_BUFFER_T35)
221 {
222 DoviRpuOpaque *rpu_in = NULL;
223 if (side_data->type == AV_FRAME_DATA_DOVI_RPU_BUFFER)
224 {
225 rpu_in = dovi_parse_unspec62_nalu(side_data->data, side_data->size);
226 }
227 else if (side_data->type == AV_FRAME_DATA_DOVI_RPU_BUFFER_T35)
228 {
229 rpu_in = dovi_parse_itu_t35_dovi_metadata_obu(side_data->data, side_data->size);
230 }
231
232 if (rpu_in == NULL)
233 {
234 hb_log("rpu: dovi_parse failed");
235 break;
236 }
237
238 if (pv->mode & RPU_MODE_CONVERT_TO_8_1)
239 {
240 const DoviRpuDataHeader *header = dovi_rpu_get_header(rpu_in);
241 if (header && header->guessed_profile == 7)
242 {
243 // Convert the BL to 8.1
244 int ret = dovi_convert_rpu_with_mode(rpu_in, 2);
245 if (ret < 0)
246 {
247 hb_log("rpu: dovi_convert_rpu_with_mode failed");
248 }
249 }
250
251 if (header)
252 {
253 dovi_rpu_free_header(header);

Callers

nothing calls this directly

Calls 6

apply_rpu_if_neededFunction · 0.85
hb_logFunction · 0.85
hb_rotate_geometryFunction · 0.85
save_rpuFunction · 0.85

Tested by

no test coverage detected