Remove old unnecessary functions from search module.

- As we move to per-LCU encoding only search_lcu will be necessary.

- Function search_best_mode is no longer used.
Refactor coding of end_of_slice_segment_flag.

According to spec the end_of_slice_segment_flag is always coded, but in the
code it looked like it was not coded for the last LCU in picture. This was
due to the end_of_slice_segment_flag being coded inside cabac_flush, like it
is in HM. This is a bit silly so I moved it out of cabac_flush.
Clean up encode_one_frame.

There is a lot of duplicated code due to handling random access and trailing
pictures separately. I merged the code for these two branches so it would be
easier to modify.