mpegvideo_enc: rework direct mode check

Remove stray semicolon and share codepaths.

CC: libav-stable@libav.org
Bug-Id: CID 991857
mpegvideo_enc: factor out denominator and explicitly cast operands

CC: libav-stable@libav.org
Bug-Id: CID 608053
mpeg12enc: factor out check in encode_dc

Makes coverity less confused and the code more readable.

CC: libav-stable@libav.org
Bug-Id: CID 751744
mpeg12dec: simplify context duplication

CC: libav-stable@libav.org
Bug-Id: CID 717453 / CID 717454 / CID 717915
pthreads_frame: Do not leak on failure path

CC: libav-stable@libav.org
Bug-Id: CID 1135767
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
mjpegdec: fix undefined shift

Add a comment to explain the code.

CC: libav-stable@libav.org
Bug-Id: CID 1194388