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

Function x265_encode

libhb/encx265.c:686–794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686static hb_buffer_t* x265_encode(hb_work_object_t *w, hb_buffer_t *in)
687{
688 hb_work_private_t *pv = w->private_data;
689 hb_job_t *job = pv->job;
690 x265_picture pic_in, pic_out;
691
692 x265_nal *nal;
693 uint32_t nnal;
694 int ret;
695
696 pv->api->picture_init(pv->param, &pic_in);
697
698 pic_in.stride[0] = in->plane[0].stride;
699 pic_in.stride[1] = in->plane[1].stride;
700 pic_in.stride[2] = in->plane[2].stride;
701 pic_in.planes[0] = in->plane[0].data;
702 pic_in.planes[1] = in->plane[1].data;
703 pic_in.planes[2] = in->plane[2].data;
704 pic_in.poc = pv->frames_in++;
705 pic_in.pts = in->s.start;
706 pic_in.bitDepth = pv->bit_depth;
707
708 x265_sei *sei = &pic_in.userSEI;
709 sei->numPayloads = 0;
710
711 if (job->passthru_dynamic_hdr_metadata)
712 {
713 for (int i = 0; i < in->nb_side_data; i++)
714 {
715 const AVFrameSideData *side_data = in->side_data[i];
716 if (job->passthru_dynamic_hdr_metadata & HB_HDR_DYNAMIC_METADATA_HDR10PLUS &&
717 side_data->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS)
718 {
719 uint8_t *payload = NULL;
720 uint32_t playload_size = 0;
721 void *tmp;
722 x265_sei_payload *sei_payload = NULL;
723
724 hb_dynamic_hdr10_plus_to_itu_t_t35((AVDynamicHDRPlus *)side_data->data, &payload, &playload_size);
725 if (!playload_size)
726 {
727 continue;
728 }
729
730 tmp = av_fast_realloc(pv->sei_data, &pv->sei_data_size,
731 (sei->numPayloads + 1) * sizeof(*sei_payload));
732
733 if (!tmp)
734 {
735 continue;
736 }
737
738 pv->sei_data = tmp;
739 sei->payloads = pv->sei_data;
740 sei_payload = &sei->payloads[sei->numPayloads];
741 sei_payload->payload = payload;
742 sei_payload->payloadSize = playload_size;
743 sei_payload->payloadType = USER_DATA_REGISTERED_ITU_T_T35;

Callers 1

encx265WorkFunction · 0.85

Calls 5

hb_chapter_enqueueFunction · 0.85
hb_logFunction · 0.85
save_frame_infoFunction · 0.70
nal_encodeFunction · 0.70

Tested by

no test coverage detected