| 851 | } |
| 852 | |
| 853 | static hb_buffer_t *x264_encode( hb_work_object_t *w, hb_buffer_t *in ) |
| 854 | { |
| 855 | hb_work_private_t *pv = w->private_data; |
| 856 | hb_job_t *job = pv->job; |
| 857 | hb_buffer_t *tmp = NULL; |
| 858 | |
| 859 | /* Point x264 at our current buffers Y(UV) data. */ |
| 860 | if (pv->pic_in.img.i_csp & X264_CSP_HIGH_DEPTH && |
| 861 | (job->output_pix_fmt == AV_PIX_FMT_YUV420P || |
| 862 | job->output_pix_fmt == AV_PIX_FMT_YUV422P || |
| 863 | job->output_pix_fmt == AV_PIX_FMT_YUV444P)) |
| 864 | { |
| 865 | tmp = expand_buf(pv->api->bit_depth, in, job->output_pix_fmt); |
| 866 | pv->pic_in.img.i_stride[0] = tmp->plane[0].stride; |
| 867 | pv->pic_in.img.i_stride[1] = tmp->plane[1].stride; |
| 868 | pv->pic_in.img.i_stride[2] = tmp->plane[2].stride; |
| 869 | pv->pic_in.img.plane[0] = tmp->plane[0].data; |
| 870 | pv->pic_in.img.plane[1] = tmp->plane[1].data; |
| 871 | pv->pic_in.img.plane[2] = tmp->plane[2].data; |
| 872 | } |
| 873 | else |
| 874 | { |
| 875 | pv->pic_in.img.i_stride[0] = in->plane[0].stride; |
| 876 | pv->pic_in.img.i_stride[1] = in->plane[1].stride; |
| 877 | pv->pic_in.img.i_stride[2] = in->plane[2].stride; |
| 878 | pv->pic_in.img.plane[0] = in->plane[0].data; |
| 879 | pv->pic_in.img.plane[1] = in->plane[1].data; |
| 880 | pv->pic_in.img.plane[2] = in->plane[2].data; |
| 881 | } |
| 882 | |
| 883 | if( in->s.new_chap > 0 && job->chapter_markers ) |
| 884 | { |
| 885 | /* chapters have to start with an IDR frame so request that this |
| 886 | frame be coded as IDR. Since there may be up to 16 frames |
| 887 | currently buffered in the encoder remember the timestamp so |
| 888 | when this frame finally pops out of the encoder we'll mark |
| 889 | its buffer as the start of a chapter. */ |
| 890 | pv->pic_in.i_type = X264_TYPE_IDR; |
| 891 | hb_chapter_enqueue(pv->chapter_queue, in); |
| 892 | } |
| 893 | else |
| 894 | { |
| 895 | pv->pic_in.i_type = X264_TYPE_AUTO; |
| 896 | } |
| 897 | |
| 898 | /* XXX this is temporary debugging code to check that the upstream |
| 899 | * modules (render & sync) have generated a continuous, self-consistent |
| 900 | * frame stream with the current frame's start time equal to the |
| 901 | * previous frame's stop time. |
| 902 | */ |
| 903 | if (pv->last_stop != AV_NOPTS_VALUE && pv->last_stop != in->s.start) |
| 904 | { |
| 905 | hb_log("encx264 input continuity err: last stop %"PRId64" start %"PRId64, |
| 906 | pv->last_stop, in->s.start); |
| 907 | } |
| 908 | pv->last_stop = in->s.stop; |
| 909 | |
| 910 | // Remember info about this frame that we need to pass across |
no test coverage detected