Disclosed is an coding apparatus, an coding method, an coding method program, and a recording medium recording the coding method program. The present invention is applicable to transmission of motion pictures using satellite broadcasts, cable television, Internet, cellular phones, and the like, and recording of motion pictures on recording media such as optical disks, magnetic optical disks, flash memory, and the like, for example. In this manner, the coding apparatus can be also constructed to function as a decoding apparatus and an image conversion apparatus. An embodiment of the present invention can simplify the overall construction of such coding apparatus. An embodiment of the present invention detects an optimum prediction mode for intra prediction and inter prediction prior to a coding process. The embodiment detects variables IntraSAD, InterSAD, and (X) indicating differential data sizes according to the detected optimum prediction mode. The embodiment determines target code amounts for pictures according to the variables IntraSAD, InterSAD, and (X).